Python - connecting with twitter's API -
i wrote script connect twitter's api. script works perfect on pc. here script, grabs tweets word 'car' in them:
from tweepy.streaming import stream tweepy import oauthhandler tweepy import streamlistener ckey='mycustomerkey' csecret='mycustomersecret' atoken='mytoken' asecret='mysecret' class listener(streamlistener): def on_data(self,data): print data return true def on_error(self, status): print status auth=oauthhandler(ckey,csecret) auth.set_access_token(atoken, asecret) twitterstream=stream(auth, listener()) twitterstream.filter(track=['car'])
as said, works perfect on machine. but, when copied script external server (and of course, downloaded relevant module (tweepy))- error:
runfile('z:/data/twitter/grab_tweets.py', wdir='z:/data/twitter') traceback (most recent call last): file "<ipython-input-5-74327b031634>", line 1, in <module> runfile('z:/data/twitter/grab_tweets.py', wdir='z:/data/twitter') file "c:\anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 685, in runfile execfile(filename, namespace) file "c:\anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 71, in execfile exec(compile(scripttext, filename, 'exec'), glob, loc) file "z:/data/twitter/grab_tweets.py", line 25, in <module> twitterstream.filter(track=['car']) file "build\bdist.win-amd64\egg\tweepy\streaming.py", line 445, in filter self._start(async) file "build\bdist.win-amd64\egg\tweepy\streaming.py", line 361, in _start self._run() file "build\bdist.win-amd64\egg\tweepy\streaming.py", line 294, in _run raise exception connectionerror: ('connection aborted.', error(10053, 'an established connection aborted software in host machine')
i looked error - saw firewall, tried turn off- didn't help.
any idea?
you need authenticate proxy server. i'm not sure if possible tweepy.
you try using twitterapi supports proxy authentication. see doc.
Comments
Post a Comment