Compare commits

...

2 Commits

Author SHA1 Message Date
3270e3fe2c
Can Also read in API Keys from a file 2024-08-05 10:41:51 +02:00
f209e0e452
Changed Endpoint 2024-08-05 10:30:45 +02:00

View File

@ -26,6 +26,10 @@ BUFFER_SIZE = convert_to_bytes(CONFIG['buffer-size'])
MAX_SIZE = convert_to_bytes(CONFIG['max-size'])
MAX_DATA = convert_to_bytes(CONFIG['max-data'])
AUTHORIZED_KEYS = CONFIG['keys']
if isinstance(AUTHORIZED_KEYS, str):
with open(AUTHORIZED_KEYS) as file:
AUTHORIZED_KEYS = list(
filter(lambda x: x.strip() != '', file.read().splitlines()))
DATABASE = CONFIG['database']
if not exists(DATABASE):
@ -43,7 +47,7 @@ class MinSizePerRequestError(Exception):
pass
@api.get('/')
@api.get('/zeros')
async def test_data(api_key: str, size: str) -> StreamingResponse:
try:
if api_key not in AUTHORIZED_KEYS: