cleanup
This commit is contained in:
6
util.py
6
util.py
@ -3,19 +3,13 @@
|
||||
import logging
|
||||
|
||||
from fastapi import FastAPI, Response, HTTPException, Security
|
||||
from fastapi.security import APIKeyHeader, APIKeyQuery
|
||||
|
||||
global api_key_query
|
||||
global api_key_header
|
||||
|
||||
class Utilities:
|
||||
def __init__(self, app: FastAPI, constants):
|
||||
self.constants = constants
|
||||
self.blocked_response_status = 422
|
||||
self.blocked_response_content = None
|
||||
|
||||
self.api_key_query = APIKeyQuery(name=constants.API_KEY_NAME, auto_error=False)
|
||||
self.api_key_header = APIKeyHeader(name=f"x-{constants.API_KEY_NAME}", auto_error=False)
|
||||
|
||||
def get_blocked_response(self, path: str | None = None):
|
||||
logging.error("Rejected request: Blocked")
|
||||
|
Reference in New Issue
Block a user