Clean up and debugging.

This commit is contained in:
Scott Idem
2023-01-30 17:29:01 -05:00
parent bbf23e9f0b
commit b510a44adf
3 changed files with 11 additions and 9 deletions

View File

@@ -26,7 +26,6 @@ def get_token_header(x_token: str = Header(...)):
# ### END ### API Lib General ### async get_token_header() ###
# ### BEGIN ### API Lib General ### class Common_Route_Params ###
# Updated 2023-01-30
class Common_Route_Params_No_Account_ID:
@@ -93,7 +92,6 @@ def common_route_params_no_account_id(
# ### END ### API Lib General ### async common_route_params() ###
# ### BEGIN ### API Lib General ### class Common_Route_Params ###
# Updated 2022-01-05
class Common_Route_Params:
@@ -161,6 +159,7 @@ def common_route_params(
# ### BEGIN ### API Lib General ### class Common_Route_Params_Min ###
# Updated 2022-01-05
# NOTE: Is this essentially the same as Common_Route_Params_No_Account_ID above?
class Common_Route_Params_Min:
def __init__(
self,
@@ -187,6 +186,7 @@ class Common_Route_Params_Min:
# ### BEGIN ### API Lib General ### common_route_params_min() ###
# Updated 2022-02-15
# NOTE: Is this essentially the same as common_route_params_no_account_id above?
@logger_reset # This breaks things for some reason when the function is async. Do not use async def common_route_params()!
def common_route_params_min(
x_account_id: str = Header(None, min_length=11, max_length=22),
@@ -373,7 +373,7 @@ def return_full_tmp_path(
subdir_path: str = None,
filename: str = None,
) -> bool|str:
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
hosted_tmp_path = settings.FILES_PATH['hosted_tmp_root']
@@ -469,15 +469,15 @@ def send_email(
log.info('Creating SMTP SSL connection...')
context = ssl.create_default_context()
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.info('SMTP configuration, connect, and send')
try:
with smtplib.SMTP_SSL(settings.SMTP['server'], settings.SMTP['port'], context=context) as server:
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug('SMTP log in...')
server.login(settings.SMTP['username'], settings.SMTP['password'])
log.debug('SMTP send message...')
server.send_message(message)
log.info('Email sent')
log.info('Email sent!')
return True
except:
#except SMTPException: