2016-07-10 7 views
2

言語バージョン:パイソン2.7.11TweepyたStreamListener ConnectionError

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の初心者です、私はあなたに感謝助けてください!

+0

ネットワークに問題があるようです –

+0

中国人がTwitterにアクセスできないと思われるかもしれません。 そして私はこのコードをプロキシを設定するために追加しました:
'proxy = {'http': 'http://127.0.0.1:1080'、 'https': 'https://127.0.0.1:1080'} proxy_support = urllib2.ProxyHandler(プロキシ) オープナー= urllib2.build_opener(プロキシサポート) urllib2.install_opener(オープナー) ' しかし、動作しません。 – ShanGuangdi

+0

あなたは何を介してプロキシですか? –

答えて

0

「最大再試行回数」と思われます。私は翌日にもう一度お試しください。