From fffa0decdbc570cc9f0a1ccbdf7dd4e62d9db327 Mon Sep 17 00:00:00 2001 From: shri Date: Thu, 5 Dec 2024 10:18:52 +0100 Subject: [PATCH] Fix the fetch, response could be any type --- src/app/lib/pitchbook.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/app/lib/pitchbook.py b/src/app/lib/pitchbook.py index 1be03cd1..f1eca1f2 100644 --- a/src/app/lib/pitchbook.py +++ b/src/app/lib/pitchbook.py @@ -28,7 +28,7 @@ async def fetch_url( url: str, headers: dict[str, Any] | None = None, params: dict[str, Any] | None = None, -) -> dict[str, Any]: +) -> Any: """Fetch url.""" try: if not headers: @@ -38,8 +38,7 @@ async def fetch_url( response = await client.get(url, headers=headers) if response.status_code != 200 or not response.text: return {} - response_json = response.json() - return response_json if isinstance(response_json, dict) else {} + return response.json() except httpx.RequestError as e: await logger.awarn("Error while fetching data.", exc_info=e) return {}