From 34d6aa5a36006a5656e783da70e3521b78e6910d Mon Sep 17 00:00:00 2001 From: Kristian Krsnik Date: Fri, 12 Apr 2024 17:11:27 +0200 Subject: [PATCH] made async --- src/main.py | 2 +- src/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.py b/src/main.py index 9c0e24c..d94ebde 100644 --- a/src/main.py +++ b/src/main.py @@ -44,7 +44,7 @@ class MinSizePerRequestError(Exception): @api.get('/') -def test_data(api_key: str, request: Request, size: str) -> StreamingResponse: +async def test_data(api_key: str, request: Request, size: str) -> StreamingResponse: try: if api_key not in AUTHORIZED_KEYS: raise HTTPException( diff --git a/src/utils.py b/src/utils.py index 521e23c..d703da9 100644 --- a/src/utils.py +++ b/src/utils.py @@ -20,7 +20,7 @@ def convert_to_bytes(size: int | str) -> int: raise ValueError -def generate_data(size: int, buffer_size: int = 4 * 1024) -> bytes: +async def generate_data(size: int, buffer_size: int = 4 * 1024) -> bytes: size_left = size while size_left > buffer_size: