Skip to content

Commit

Permalink
Log error when fetching company from pdl
Browse files Browse the repository at this point in the history
  • Loading branch information
shrir committed Oct 25, 2024
1 parent 3f36e66 commit 519fede
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/app/lib/pdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ async def get_company_details(url: str = None, social_url: str = None) -> dict[s
async with httpx.AsyncClient() as client:
response = await client.get("https://api.peopledatalabs.com/v5/company/enrich", headers=headers, params=params)
data = response.json()
if not data:
await logger.awarn("Company not found.", response=data, url=url, social_url=social_url)
if response.status_code != 200 or not data:
await logger.awarn(
"Company not found.", status=response.status_code, response=data, url=url, social_url=social_url
)
raise Exception("Company not found.")
return data

Expand Down

0 comments on commit 519fede

Please sign in to comment.