Skip to content

Commit

Permalink
Fix edge case in websearch
Browse files Browse the repository at this point in the history
  • Loading branch information
paulovcmedeiros committed Feb 25, 2024
1 parent b3715c9 commit 107f457
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
license = "MIT"
name = "pyrobbot"
readme = "README.md"
version = "0.6.3"
version = "0.6.4"

[build-system]
build-backend = "poetry.core.masonry.api"
Expand Down
6 changes: 4 additions & 2 deletions pyrobbot/internet_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,13 @@ def raw_websearch(
region: str = GeneralDefinitions.IPINFO["country_name"],
):
"""Search the web using DuckDuckGo Search API."""
results = asyncio.run(
raw_results = asyncio.run(
async_raw_websearch(query=query, max_results=max_results, region=region)
)
raw_results = raw_results or []

for result in results:
results = []
for result in raw_results:
if not isinstance(result, dict):
logger.error("Expected a `dict`, got type {}: {}", type(result), result)
results.append({})
Expand Down

0 comments on commit 107f457

Please sign in to comment.