Minor changes and fixes.
This commit is contained in:
@@ -44,11 +44,11 @@ class Event_Device_Base(BaseModel):
|
||||
|
||||
api_secret_key: Optional[str]
|
||||
|
||||
api_server_base_url: Optional[str]
|
||||
api_base_url: Optional[str]
|
||||
app_server_base_url: Optional[str]
|
||||
file_server_base_url: Optional[str]
|
||||
|
||||
api_server_base_url_bak: Optional[str] # Backup URL
|
||||
api_base_url_bak: Optional[str] # Backup URL
|
||||
app_server_base_url_bak: Optional[str] # Backup URL
|
||||
file_server_base_url_bak: Optional[str] # Backup URL
|
||||
|
||||
@@ -71,7 +71,7 @@ class Event_Device_Base(BaseModel):
|
||||
trigger_show_admin: Optional[str]
|
||||
trigger_show_hidden: Optional[str]
|
||||
|
||||
host_file_cache_path: Optional[str] # Path for hash file cache only
|
||||
local_file_cache_path: Optional[str] # Path for hash file cache only
|
||||
host_file_temp_path: Optional[str] # Path for copied and renamed temporary files from hash file cache directory
|
||||
recording_path: Optional[str] # Path to save recordings
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ async def get_event_device_obj(
|
||||
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
):
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
# ### SECTION ### Secondary data validation
|
||||
|
||||
@@ -279,10 +279,11 @@ async def download_event_file(
|
||||
log.info(f'Full file path with subdirectory: {file_path_w_subdir}')
|
||||
|
||||
if os.path.exists(file_path_w_subdir):
|
||||
log.info('Hosted file found on server.')
|
||||
return FileResponse(file_path_w_subdir, filename=filename)
|
||||
else:
|
||||
log.error(f'The hosted file was not found on the server. Hash: {hash_sha256}')
|
||||
return mk_resp(data=False, status_code=400, response=commons.response, status_message='The hosted file was not found on the server.') # Bad Request
|
||||
return mk_resp(data=False, status_code=404, response=commons.response, status_message=f'The hosted file was not found on the server. Hash: {hash_sha256}') # Not Found
|
||||
# ### END ### API Event File ### download_event_file() ###
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user