Work on temporary hosted files

This commit is contained in:
Scott Idem
2021-11-25 12:54:41 -05:00
parent 523a7378c6
commit 54a084d2cb
4 changed files with 18 additions and 18 deletions

View File

@@ -433,7 +433,7 @@ async def get_hosted_file_obj(
# ### BEGIN ### API Hosted File ### download_tmp() ###
# Updated 2021-11-23
@router.get('/download/{filename}', response_model=Resp_Body_Base)
@router.get('/download/tmp/{filename}', response_model=Resp_Body_Base)
async def download_tmp(
filename: str = Query(..., min_length=4, max_length=100),
# x_account_id: str = Header(...),

View File

@@ -99,19 +99,11 @@ async def get_obj_id_order_line_list(
current_datetime_utc = datetime.datetime.utcnow()
current_datetime_utc = current_datetime_utc.strftime(datetime_format)
filename = f'order_line_list_{current_datetime_utc}'
create_export_file(data_dict_list=data_dict_list_for_export, subdir_path='order_line', filename=filename, export_type='Excel')
if result := create_export_file(data_dict_list=data_dict_list_for_export, subdir_path='order_line', filename=filename, export_type='Excel'):
tmp_file_path = result
else:
log.error('Something went wrong while creating or saving the export file')
tmp_file_path = result
# print(response_data)
# full_file_path = 'admin/temp/export_test_1.csv'
# full_file_path_xlsx = 'admin/temp/export_test_1.xlsx'
# keys = response_data[0].keys()
# print(keys)
# order_line_obj_dataframe = pandas.DataFrame(response_data)
# print(order_line_obj_dataframe)
# order_line_obj_dataframe.to_csv(full_file_path, columns=keys, index=False)
# order_line_obj_dataframe.to_excel(full_file_path_xlsx, columns=keys, index=False) # sheet_name='Sheet_name_1'
return mk_resp(data=response_data)
return mk_resp(data=response_data, tmp_file_path=tmp_file_path)
# ### END ### API Order Line ### get_obj_id_order_line_list() ###