Skip to content

Commit

Permalink
maps(): raise exception if coordinates are not found
Browse files Browse the repository at this point in the history
  • Loading branch information
deedy5 committed Mar 7, 2024
1 parent 21d4774 commit cfc1361
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions duckduckgo_search/duckduckgo_search_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,8 @@ async def maps(
"https://nominatim.openstreetmap.org/search.php",
params=params,
)
if resp_content == b"[]":
raise DuckDuckGoSearchException("maps() Сoordinates are not found, check function parameters.")
resp_json = json_loads(resp_content)
coordinates = resp_json[0]["boundingbox"]
lat_t, lon_l = Decimal(coordinates[1]), Decimal(coordinates[2])
Expand Down

0 comments on commit cfc1361

Please sign in to comment.