Update internet.py

This commit is contained in:
H Lohaus 2024-11-16 13:12:02 +01:00 committed by GitHub
parent 61428de4f3
commit bc79969e5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -97,9 +97,9 @@ async def fetch_and_scrape(session: ClientSession, url: str, max_words: int = No
async def search(query: str, n_results: int = 5, max_words: int = 2500, add_text: bool = True) -> SearchResults:
if not has_requirements:
raise MissingRequirementsError('Install "duckduckgo-search" and "beautifulsoup4" package')
async with DDGS() as ddgs:
with DDGS() as ddgs:
results = []
for result in await ddgs.atext(
for result in ddgs.text(
query,
region="wt-wt",
safesearch="moderate",