Tweety StreamListener ConnectionError

时间:2016-07-10 13:22:46

标签: python twitter python-requests tweepy

语言版本:python 2.7.11

from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
access_token = "****"
access_token_secret = "****"
consumer_key = "****"
consumer_secret = "****"
class StdOutListener(StreamListener):
    def on_data(self, data):
        print data
        return True

    def on_error(self, status):
        print status
if __name__ == '__main__':
    l = StdOutListener()
    auth = OAuthHandler(consumer_key, consumer_secret)
    auth.set_access_token(access_token, access_token_secret)
    stream = Stream(auth, l)
    stream.filter(track=['python', 'javascript', 'ruby'])

我收到这些错误信息:

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='stream.twitter.com', port=443): Max retries  
exceeded with url: /1.1/statuses/filter.json?delimited=length (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000000002EABD30>: 
Failed to establish a new connection: [Errno 10060] ',))

我是中国Python的初学者,请帮帮我谢谢!

1 个答案:

答案 0 :(得分:0)

我猜它说&#34; max retries&#34;。我第二天再试一次,它确实有效。

相关问题