Compare commits

..

4 Commits

Author SHA1 Message Date
9ef9c8454b
use hyphen for query parameter 2024-04-11 23:18:51 +02:00
8f2a575010
typo 2024-04-11 23:18:37 +02:00
654f2982de
removed unneeded file 2024-04-11 23:13:17 +02:00
f0230bbbc3
disabled docs 2024-04-11 23:13:11 +02:00
3 changed files with 4 additions and 4 deletions

View File

@ -13,6 +13,6 @@
"TESTKEY" "TESTKEY"
], ],
"max-data": "10GB", "max-data": "10GB",
"database": "databse.json" "database": "database.json"
} }
``` ```

View File

@ -4,7 +4,7 @@ import argparse
import json import json
from os.path import exists from os.path import exists
from fastapi import FastAPI, Request, HTTPException from fastapi import FastAPI, Request, HTTPException, Query
from fastapi.responses import StreamingResponse from fastapi.responses import StreamingResponse
from fastapi import status from fastapi import status
from hypercorn.config import Config from hypercorn.config import Config
@ -32,7 +32,7 @@ if not exists(DATABASE):
save_database(DATABASE, {'data-used': 0}) save_database(DATABASE, {'data-used': 0})
api = FastAPI() api = FastAPI(docs_url=None, redoc_url=None)
class MaxSizePerRequestError(Exception): class MaxSizePerRequestError(Exception):
@ -44,7 +44,7 @@ class MinSizePerRequestError(Exception):
@api.get('/') @api.get('/')
def test_data(api_key: str, size: str, request: Request) -> StreamingResponse: def test_data(request: Request, size: str, api_key: str = Query(..., alias="api-key")) -> StreamingResponse:
try: try:
if api_key not in AUTHORIZED_KEYS: if api_key not in AUTHORIZED_KEYS:
raise HTTPException( raise HTTPException(

View File