This commit is contained in:
2024-08-14 22:47:48 -04:00
parent ebc9460b8d
commit 56ae0071fa
3 changed files with 1 additions and 22 deletions

View File

@ -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")