R
R
Roman Shavukhin2020-05-24 22:09:28
Google
Roman Shavukhin, 2020-05-24 22:09:28

When processing search results through google library in python gives 429: to many requests error after 17 replies?

here is the error:

Traceback (most recent call last):
File "C:\Users\Roman\Desktop\Python Sites\searchs_site.py", line 7, in
for j in search(qr, tld='com', lang= 'en', num=1, start=0, stop=None, pause=5.0):
File "C:\Users\Roman\AppData\Local\Programs\Python\Python38-32\lib\site-packages\googlesearch\ __init__.py", line 312, in search
html = get_page(url, user_agent)
File "C:\Users\Roman\AppData\Local\Programs\Python\Python38-32\lib\site-packages\googlesearch\__init__.py ", line 176, in get_page
response = urlopen(request)
File "C:\Users\Roman\AppData\Local\Programs\Python\Python38-32\lib\urllib\request.py", line 222, in urlopen
return opener .open(url, data,timeout)
File "C:\Users\Roman\AppData\Local\Programs\Python\Python38-32\lib\urllib\request.py", line 531, in open
response = meth(req, response)
File "C:\Users\ Roman\AppData\Local\Programs\Python\Python38-32\lib\urllib\request.py", line 640, in http_response
response = self.parent.error(
File "C:\Users\Roman\AppData\Local\Programs \Python\Python38-32\lib\urllib\request.py", line 563, in error
result = self._call_chain(*args)
File "C:\Users\Roman\AppData\Local\Programs\Python\Python38-32 \lib\urllib\request.py", line 502, in _call_chain
result = func(*args)
File "C:\Users\Roman\AppData\Local\Programs\Python\Python38-32\lib\urllib\request.py ", line 755, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "C:\Users\Roman\AppData\Local\Programs\Python\Python38-32\lib\urllib\request.py", line 531, in open
response = meth(req, response)
File "C:\Users\Roman\AppData\Local\Programs\Python\Python38-32\lib\urllib\request.py", line 640, in http_response
response = self.parent.error (
File "C:\Users\Roman\AppData\Local\Programs\Python\Python38-32\lib\urllib\request.py", line 569, in error
return self._call_chain(*args)
File "C:\Users \Roman\AppData\Local\Programs\Python\Python38-32\lib\urllib\request.py", line 502, in _call_chain
result = func(*args)
File "C:\Users\Roman\AppData\Local\Programs\Python\Python38-32\lib\urllib\request.py", line 649, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 429: Too Many Requests

here is the source code of the program:

qr = 'allintitle:GTX1080 site:https://citilink.ru'
try:
  from googlesearch import search
except ImportError: 
  print("Модуль 'google' не найден")
#try:
for j in search(qr, tld='com', lang='en', num=1, start=0, stop=None, pause=5.0):
  print(j)
#except:
  #print('Запрос не обработан')

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question