HTTPError using ddgs.text()
tybantarnusa opened this issue · comments
Describe the bug
I got this generic HTTPError using text() following exactly the code like in the example here.
Traceback (most recent call last):
File "E:\Projects\test.py", line 5, in <module>
for r in ddgs.text(1, region='wt-wt', safesearch='Off', timelimit='y'):
File "E:\Projects\venv\Lib\site-packages\duckduckgo_search\duckduckgo_search.py", line 150, in text
yield from self._text_api(keywords, region, safesearch, timelimit)
File "E:\Projects\venv\Lib\site-packages\duckduckgo_search\duckduckgo_search.py", line 203, in _text_api
resp = self._get_url(
^^^^^^^^^^^^^^
File "E:\Projects\venv\Lib\site-packages\duckduckgo_search\duckduckgo_search.py", line 89, in _get_url
raise ex
File "E:\Projects\venv\Lib\site-packages\duckduckgo_search\duckduckgo_search.py", line 82, in _get_url
raise httpx._exceptions.HTTPError("")
httpx.HTTPError
This is the code:
from duckduckgo_search import DDGS
q = input('Search: ')
with DDGS() as ddgs:
for r in ddgs.text(q, region='wt-wt', safesearch='Off', timelimit='y'):
print(r)
Information
- Windows 10
- duckduckgo_search version 3.8.4
The error occurs because the parameter safesearch='Off' is capitalized, you need safesearch='off'.
There was an error in the Readme. Please correct it to be like this:
from duckduckgo_search import DDGS
q = input('Search: ')
with DDGS() as ddgs:
for r in ddgs.text(q, region='wt-wt', safesearch='off', timelimit='y', backend='lite'):
print(r)