Skip to content

Commit

Permalink
Fix the fetch, response could be any type
Browse files Browse the repository at this point in the history
  • Loading branch information
shrir committed Dec 5, 2024
1 parent 546e2de commit fffa0de
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/app/lib/pitchbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 {}
Expand Down

0 comments on commit fffa0de

Please sign in to comment.