我昨天使用的是同一程序,应该打开浏览器并在其中插入查询。昨天运转良好。今天,它引发了错误。
from googlesearch import *
import webbrowser
#to search, will ask search query at the time of execution
query = input("Input your query:")
for url in search(query, tld="co.in", num=1, stop = 1, pause = 2):
webbrowser.open("https://google.com/search?q=%s" % query)'
这是我得到的错误:
Traceback (most recent call last):
File "C:/Users/DELL/AppData/Local/Programs/Python/Python37-32/arehojayaar.py", line 5, in <module>
for url in search(query, tld="co.in", num=1, stop = 1, pause = 2):
File "C:\Users\DELL\AppData\Local\Programs\Python\Python37-32\lib\site-packages\googlesearch\__init__.py", line 288, in search
html = get_page(url, user_agent)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python37-32\lib\site-packages\googlesearch\__init__.py", line 154, in get_page
response = urlopen(request)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python37-32\lib\urllib\request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python37-32\lib\urllib\request.py", line 531, in open
response = meth(req, response)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python37-32\lib\urllib\request.py", line 641, in http_response
'http', request, response, code, msg, hdrs)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python37-32\lib\urllib\request.py", line 563, in error
result = self._call_chain(*args)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python37-32\lib\urllib\request.py", line 503, in _call_chain
result = func(*args)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python37-32\lib\urllib\request.py", line 755, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python37-32\lib\urllib\request.py", line 531, in open
response = meth(req, response)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python37-32\lib\urllib\request.py", line 641, in http_response
'http', request, response, code, msg, hdrs)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python37-32\lib\urllib\request.py", line 569, in error
return self._call_chain(*args)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python37-32\lib\urllib\request.py", line 503, in _call_chain
result = func(*args)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python37-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
答案 0 :(得分:0)
您收到HTTP Error 429: Too Many Requests
,这意味着您向端点发出了太多请求,服务器决定对您进行速率限制。您将不得不等待直到被允许再次执行请求。