- google-search version: 1.1.1
- Python version: Python3.8
- Operating System: Windows 10 Home 64bit
Description
Always get Http Error (429?)
File "C:\Users\hp\Documents\pythonPractice\googleSearchResult.py", line 9, in
response = GoogleSearch().search("okayu",num_results=5,prefetch_pages=False,num_prefetch_threads=10)
File "C:\Users\hp\anaconda3\lib\site-packages\googlesearch\googlesearch.py", line 57, in search
with closing(opener.open(GoogleSearch.SEARCH_URL +
File "C:\Users\hp\anaconda3\lib\urllib\request.py", line 531, in open
response = meth(req, response)
File "C:\Users\hp\anaconda3\lib\urllib\request.py", line 640, in http_response
response = self.parent.error(
File "C:\Users\hp\anaconda3\lib\urllib\request.py", line 563, in error
result = self._call_chain(*args)
File "C:\Users\hp\anaconda3\lib\urllib\request.py", line 502, in _call_chain
result = func(*args)
File "C:\Users\hp\anaconda3\lib\urllib\request.py", line 755, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "C:\Users\hp\anaconda3\lib\urllib\request.py", line 531, in open
response = meth(req, response)
File "C:\Users\hp\anaconda3\lib\urllib\request.py", line 640, in http_response
response = self.parent.error(
File "C:\Users\hp\anaconda3\lib\urllib\request.py", line 563, in error
result = self._call_chain(*args)
File "C:\Users\hp\anaconda3\lib\urllib\request.py", line 502, in _call_chain
result = func(*args)
File "C:\Users\hp\anaconda3\lib\urllib\request.py", line 755, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "C:\Users\hp\anaconda3\lib\urllib\request.py", line 531, in open
response = meth(req, response)
File "C:\Users\hp\anaconda3\lib\urllib\request.py", line 640, in http_response
response = self.parent.error(
File "C:\Users\hp\anaconda3\lib\urllib\request.py", line 569, in error
return self._call_chain(*args)
File "C:\Users\hp\anaconda3\lib\urllib\request.py", line 502, in _call_chain
result = func(*args)
File "C:\Users\hp\anaconda3\lib\urllib\request.py", line 649, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
HTTPError: Too Many Requests
What I Did
from googlesearch.googlesearch import GoogleSearch
response = GoogleSearch().search("okayu",num_results=5,prefetch_pages=False,num_prefetch_threads=10)
for result in response.results:
print("Title: " + result.title)
print("Content: " + result.getText())