A lot of code clean up! Also adding in Response everywhere...
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import datetime
|
||||
#from datetime import datetime, time, timedelta
|
||||
from fastapi import APIRouter, Body, Depends, Header, HTTPException, Query, status
|
||||
from fastapi import APIRouter, Body, Depends, Header, HTTPException, Query, Response, status
|
||||
from pydantic import BaseModel, EmailStr, Field
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
|
||||
@@ -45,6 +45,7 @@ async def request_jwt(
|
||||
max_ttl: int = 300, # Number of seconds to live. Only use if given the API secret key.
|
||||
# Seconds: 3600 = 1 hr; 300 = 5 min
|
||||
max_renew: int = 5, # Decrease count by 1 until 0 if only sent a current API token.
|
||||
response: Response = Response,
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -136,6 +137,7 @@ async def get_api_temp_token(
|
||||
x_aether_api_key: Optional[str] = Header(None),
|
||||
x_aether_api_token: Optional[str] = Header(None),
|
||||
x_aether_api_token_expire_on: Optional[str] = Header(None),
|
||||
response: Response = Response,
|
||||
):
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -162,7 +164,7 @@ async def get_api_temp_token(
|
||||
return mk_resp(data=resp_data)
|
||||
else:
|
||||
log.debug(sql_result)
|
||||
return mk_resp(data=False, status_code=404)
|
||||
return mk_resp(data=False, status_code=404, response=response)
|
||||
|
||||
#obj_type = 'api'
|
||||
#result = get_obj_template(
|
||||
@@ -181,6 +183,7 @@ async def post_api_obj(
|
||||
return_obj: Optional[bool] = True,
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
response: Response = Response,
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -205,6 +208,7 @@ async def patch_api_obj(
|
||||
return_obj: Optional[bool] = True,
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
response: Response = Response,
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -231,6 +235,7 @@ async def get_api_obj_li(
|
||||
x_account_id: str = Header(...),
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
response: Response = Response,
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -252,6 +257,7 @@ async def get_api_obj(
|
||||
x_account_id: str = Header(...),
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
response: Response = Response,
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -270,6 +276,7 @@ async def get_api_obj(
|
||||
async def delete_api_obj(
|
||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
||||
x_account_id: str = Header(...),
|
||||
response: Response = Response,
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -289,6 +296,7 @@ async def get_api_object_id(
|
||||
x_account_id: str = Header(...),
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
response: Response = Response,
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
Reference in New Issue
Block a user