Fix: unknown bool param of type str
This commit is contained in:
parent
04781ea7a4
commit
874dffedc9
@ -6,3 +6,4 @@ __pycache__
|
|||||||
DataBase/image_temp/
|
DataBase/image_temp/
|
||||||
DataBase/json_temp/
|
DataBase/json_temp/
|
||||||
DataBase/template.db
|
DataBase/template.db
|
||||||
|
key_value_understanding-20231024-125646_manulife2/
|
@ -326,3 +326,21 @@ def build_url(folder: str, data_id: str, user_id: int, file_name: str = None) ->
|
|||||||
def build_media_url_v2(media_id: str, user_id: int, sub_id: int, u_sync_id: str) -> str:
|
def build_media_url_v2(media_id: str, user_id: int, sub_id: int, u_sync_id: str) -> str:
|
||||||
token = image_authenticator.generate_img_token_v2(user_id, sub_id, u_sync_id)
|
token = image_authenticator.generate_img_token_v2(user_id, sub_id, u_sync_id)
|
||||||
return f'{settings.BASE_URL}/api/ctel/v2/media/request/{media_id}/?token={token}'
|
return f'{settings.BASE_URL}/api/ctel/v2/media/request/{media_id}/?token={token}'
|
||||||
|
|
||||||
|
def json2xlsx(input: json):
|
||||||
|
"""_summary_
|
||||||
|
|
||||||
|
Args:
|
||||||
|
input (json):
|
||||||
|
: [{
|
||||||
|
Subs: Jan, # Subtotal name
|
||||||
|
Metadata: {num_imei: 1,
|
||||||
|
...: ...}
|
||||||
|
Data: [{num_imei: 1,
|
||||||
|
...: ...}]
|
||||||
|
}]
|
||||||
|
OR
|
||||||
|
|
||||||
|
"""
|
||||||
|
# return xlsx
|
||||||
|
pass
|
@ -104,7 +104,9 @@ def validate_ocr_request_and_get(request, subscription):
|
|||||||
FileUtils.validate_list_file(list_file)
|
FileUtils.validate_list_file(list_file)
|
||||||
validated_data['file'] = list_file[0]
|
validated_data['file'] = list_file[0]
|
||||||
|
|
||||||
validated_data['is_test_request'] = request.data.get('is_test_request', False)
|
# validated_data['is_test_request'] = bool(request.data.get('is_test_request', False))
|
||||||
|
validated_data['is_test_request'] = string_to_boolean(request.data.get('is_test_request', "false"))
|
||||||
|
# print(f"[DEBUG]: is_test_request: ", validated_data['is_test_request'])
|
||||||
|
|
||||||
return validated_data
|
return validated_data
|
||||||
|
|
||||||
@ -139,9 +141,22 @@ def sbt_validate_ocr_request_and_get(request, subscription):
|
|||||||
validated_data['imei_file'] = imei_files
|
validated_data['imei_file'] = imei_files
|
||||||
validated_data['invoice_file'] = invoice_file
|
validated_data['invoice_file'] = invoice_file
|
||||||
validated_data['redemption_ID'] = redemption_ID
|
validated_data['redemption_ID'] = redemption_ID
|
||||||
|
validated_data['is_test_request'] = string_to_boolean(request.data.get('is_test_request', "false"))
|
||||||
|
# print(f"[DEBUG]: is_test_request: ", validated_data['is_test_request'])
|
||||||
|
|
||||||
return validated_data
|
return validated_data
|
||||||
|
|
||||||
|
def string_to_boolean(value):
|
||||||
|
true_strings = ['true', 'yes', '1', 'on']
|
||||||
|
false_strings = ['false', 'no', '0', 'off']
|
||||||
|
|
||||||
|
if isinstance(value, str):
|
||||||
|
lower_value = value.lower()
|
||||||
|
if lower_value in true_strings:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
def sbt_validate_feedback(request):
|
def sbt_validate_feedback(request):
|
||||||
validated_data = {}
|
validated_data = {}
|
||||||
|
|
||||||
|
@ -139,7 +139,6 @@ services:
|
|||||||
condition: service_started
|
condition: service_started
|
||||||
volumes:
|
volumes:
|
||||||
- BE_media:${MEDIA_ROOT}
|
- BE_media:${MEDIA_ROOT}
|
||||||
|
|
||||||
working_dir: /app
|
working_dir: /app
|
||||||
command: sh -c "celery -A fwd_api.celery_worker.worker worker -l INFO -c 5"
|
command: sh -c "celery -A fwd_api.celery_worker.worker worker -l INFO -c 5"
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ def make_sbt_request(host, token, invoice_files=None, imei_files=None, ensure_su
|
|||||||
files.append(('imei_files', (file, open(file, "rb"), 'application/octet-stream')))
|
files.append(('imei_files', (file, open(file, "rb"), 'application/octet-stream')))
|
||||||
num_files = len(files)
|
num_files = len(files)
|
||||||
files.append(('processType', '12'))
|
files.append(('processType', '12'))
|
||||||
files.append(('is_test_request', 'true'))
|
files.append(('is_test_request', 'True'))
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
end_of_upload_time = 0
|
end_of_upload_time = 0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user