Fix????
This commit is contained in:
@@ -31,7 +31,7 @@ orjson
|
||||
packaging
|
||||
pandas
|
||||
passlib
|
||||
pdf2image
|
||||
# pdf2image
|
||||
Pillow
|
||||
pycparser
|
||||
pydantic
|
||||
@@ -48,7 +48,7 @@ requests
|
||||
rfc3986
|
||||
six
|
||||
sniffio
|
||||
SQLAlchemy==1.4.44 # 1.4.47 is the newest I am working with
|
||||
SQLAlchemy==1.4.47 # 1.4.47 is the newest I am working with
|
||||
starlette
|
||||
stripe
|
||||
typing_extensions
|
||||
|
||||
@@ -699,44 +699,44 @@ async def get_hosted_file_obj(
|
||||
# ### END ### API Hosted File ### get_hosted_file_obj() ###
|
||||
|
||||
|
||||
# ### BEGIN ### API Hosted File ### download_tmp() ###
|
||||
# Updated 2023-04-05
|
||||
@router.get('/tmp/{subdirectory}/{filename}/download', response_model=Resp_Body_Base)
|
||||
async def download_tmp(
|
||||
subdirectory: str = Query(..., min_length=1, max_length=100),
|
||||
filename: str = Query(..., min_length=4, max_length=120),
|
||||
# # ### BEGIN ### API Hosted File ### download_tmp() ###
|
||||
# # Updated 2023-04-05
|
||||
# @router.get('/tmp/{subdirectory}/{filename}/download', response_model=Resp_Body_Base)
|
||||
# async def download_tmp(
|
||||
# subdirectory: str = Query(..., min_length=1, max_length=100),
|
||||
# filename: str = Query(..., min_length=4, max_length=120),
|
||||
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
):
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
# commons: Common_Route_Params = Depends(common_route_params),
|
||||
# ):
|
||||
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
# log.debug(locals())
|
||||
|
||||
# NOTE: WARNING NOTE: WARNING NOTE: WARNING NOTE: WARNING NOTE: WARNING NOTE: WARNING NOTE: WARNING
|
||||
time.sleep(3.5) # NOTE: WARNING NOTE: WARNING NOTE: WARNING NOTE: WARNING NOTE: WARNING NOTE: WARNING
|
||||
# NOTE: WARNING NOTE: WARNING NOTE: WARNING NOTE: WARNING NOTE: WARNING NOTE: WARNING NOTE: WARNING
|
||||
# # NOTE: WARNING NOTE: WARNING NOTE: WARNING NOTE: WARNING NOTE: WARNING NOTE: WARNING NOTE: WARNING
|
||||
# time.sleep(3.5) # NOTE: WARNING NOTE: WARNING NOTE: WARNING NOTE: WARNING NOTE: WARNING NOTE: WARNING
|
||||
# # NOTE: WARNING NOTE: WARNING NOTE: WARNING NOTE: WARNING NOTE: WARNING NOTE: WARNING NOTE: WARNING
|
||||
|
||||
hosted_tmp_path = settings.FILES_PATH['hosted_tmp_root']
|
||||
log.info(f'Hosted Tmp Path: {hosted_tmp_path}')
|
||||
log.debug(shutil.disk_usage(hosted_tmp_path))
|
||||
# hosted_tmp_path = settings.FILES_PATH['hosted_tmp_root']
|
||||
# log.info(f'Hosted Tmp Path: {hosted_tmp_path}')
|
||||
# log.debug(shutil.disk_usage(hosted_tmp_path))
|
||||
|
||||
hosted_tmp_w_subdir = os.path.join(hosted_tmp_path, subdirectory)
|
||||
# if pathlib.Path(hosted_tmp_w_subdir):
|
||||
if os.path.exists(hosted_tmp_w_subdir):
|
||||
log.info('Hosted tmp with subdirectory found')
|
||||
else:
|
||||
log.info('Hosted tmp with subdirectory not found')
|
||||
return mk_resp(data=False, status_code=404, response=commons.response, status_message='The hosted tmp file subdirectory was not found.') # Not Found
|
||||
# hosted_tmp_w_subdir = os.path.join(hosted_tmp_path, subdirectory)
|
||||
# # if pathlib.Path(hosted_tmp_w_subdir):
|
||||
# if os.path.exists(hosted_tmp_w_subdir):
|
||||
# log.info('Hosted tmp with subdirectory found')
|
||||
# else:
|
||||
# log.info('Hosted tmp with subdirectory not found')
|
||||
# return mk_resp(data=False, status_code=404, response=commons.response, status_message='The hosted tmp file subdirectory was not found.') # Not Found
|
||||
|
||||
hosted_tmp_w_subdir_filename = os.path.join(hosted_tmp_path, subdirectory, filename)
|
||||
# if pathlib.Path(hosted_tmp_w_subdir_filename):
|
||||
if os.path.exists(hosted_tmp_w_subdir_filename):
|
||||
log.info('Hosted tmp with subdirectory and filename found')
|
||||
else:
|
||||
log.info('Hosted tmp with subdirectory and filename not found')
|
||||
return mk_resp(data=False, status_code=404, response=commons.response, status_message='The hosted tmp file was not found.') # Not Found
|
||||
# hosted_tmp_w_subdir_filename = os.path.join(hosted_tmp_path, subdirectory, filename)
|
||||
# # if pathlib.Path(hosted_tmp_w_subdir_filename):
|
||||
# if os.path.exists(hosted_tmp_w_subdir_filename):
|
||||
# log.info('Hosted tmp with subdirectory and filename found')
|
||||
# else:
|
||||
# log.info('Hosted tmp with subdirectory and filename not found')
|
||||
# return mk_resp(data=False, status_code=404, response=commons.response, status_message='The hosted tmp file was not found.') # Not Found
|
||||
|
||||
return FileResponse(hosted_tmp_w_subdir_filename, filename=filename)
|
||||
# ### END ### API Hosted File ### download_tmp() ###
|
||||
# return FileResponse(hosted_tmp_w_subdir_filename, filename=filename)
|
||||
# # ### END ### API Hosted File ### download_tmp() ###
|
||||
|
||||
|
||||
# # ### BEGIN ### API Hosted File Route ### convert_file() ###
|
||||
|
||||
Reference in New Issue
Block a user