问题描述
这里为了在twitterapi获取数据,运用streamapi获取数据进行测试,在根据官方教程出现问题,采纳的教程链接https://www.youtube.com/watch?v=pUUxmvvl2FE代码:fromtweepyimportStreamfromtweepyimportOAuthHandlerfromtweepy.streamingimportStreamListeneratoken="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"asecret="Jxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"ckey="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"csecret="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"classlistener(StreamListener):defon_data(self,data):printdatareturnTruedefon_error(self,status):printstatusauth=OAuthHandler(ckey,csecret)auth.set_access_token(atoken,asecret)twitterStream=Stream(auth,listener())twitterStream.filter(track=["car"])这里密钥相关采用的是我申请的,但是在运行的时候出现如下的调试问题raceback(mostrecentcalllast):File"D:/project/python_project/TestStream/StreamApi.py",line23,in<module>twitterStream.filter(track=["car"])File"buildbdist.win-amd64eggtweepystreaming.py",line445,infilterFile"buildbdist.win-amd64eggtweepystreaming.py",line361,in_startFile"buildbdist.win-amd64eggtweepystreaming.py",line294,in_runrequests.exceptions.ConnectionError:HTTPSConnectionPool(host='stream.twitter.com',port=443):Maxretriesexceededwithurl:/1.1/statuses/filter.json?delimited=length(CausedbyNewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnectionobjectat0x0000000002F7D5F8>:Failedtoestablishanewconnection:[Errno10060]',))另外:我使用的是python2.7具体问题原因是什么请帮忙指出
解决方案
解决方案二:
你用的版本跟教程里边的是不是一样的呀?