我正在使用tweepy尝试运行基本脚本,如video所示。我以前收到401错误(不同步的时区),但我正在使用提供的密钥。我解决了这个问题,现在我得到了这个结果:
Traceback (most recent call last):
File "algotest.py", line 25, in <module>
twitterStream.filter(track=["North"])
File "/usr/local/lib/python2.7/dist-packages/tweepy-2.3-py2.7.egg/tweepy/streaming.py", line 313, in filter
File "/usr/local/lib/python2.7/dist-packages/tweepy-2.3-py2.7.egg/tweepy/streaming.py", line 235, in _start
File "/usr/local/lib/python2.7/dist-packages/tweepy-2.3-py2.7.egg/tweepy/streaming.py", line 151, in _run
File "/usr/local/lib/python2.7/dist-packages/requests-2.2.1-py2.7.egg/requests/sessions.py", line 335, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests-2.2.1-py2.7.egg/requests/sessions.py", line 438, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests-2.2.1-py2.7.egg/requests/adapters.py", line 327, in send
raise ConnectionError(e)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='stream.twitter.com', port=443): Max retries exceeded with url: /1.1/statuses/filter.json?track=North&delimited=length (Caused by <class 'socket.gaierror'>: [Errno -2] Name or service not known)
有什么方法吗?我可以触发某种重置选项吗? 提前致谢
答案 0 :(得分:1)
原来解决方案只是等待一天。谁会想到的!
答案 1 :(得分:0)
我在我的脚本中使用python-twitter模块时也遇到了同样的错误,但是当我在一段时间后尝试时它会自动解决。由于特定区间的尝试次数有限,因此当我们超过最大尝试限制时会出现此错误。