Tweepy (twitter) socket.error Errno 104 (Connection reset by peer)
Question: I am trying to acces the Streaming API, filter it by some terms and then print
out the results, using Tweepy. However I am getting the following error:

    
    
     File "/usr/local/lib/python2.6/dist-packages/tweepy-1.7.1-py2.6.egg/tweepy/streaming.py", line 110, in _run
        resp = conn.getresponse()
      File "/usr/lib/python2.6/httplib.py", line 986, in getresponse
        response.begin()
      File "/usr/lib/python2.6/httplib.py", line 391, in begin
        version, status, reason = self._read_status()
      File "/usr/lib/python2.6/httplib.py", line 349, in _read_status
        line = self.fp.readline()
      File "/usr/lib/python2.6/socket.py", line 397, in readline
        data = recv(1)
    socket.error: [Errno 104] Connection reset by peer
    

With the following code...

    
    
    import sys
    import tweepy
    from textwrap import TextWrapper
    from tweepy.streaming import StreamListener, Stream
    
    consumer_key        = ''
    consumer_secret     = ''
    access_token        = ''
    access_token_secret = ''
    
    auth1 = tweepy.OAuthHandler(consumer_key, consumer_secret)
    auth1.set_access_token(access_token, access_token_secret)
    api = tweepy.API(auth1)
    
    class StreamListener(tweepy.StreamListener):
        status_wrapper = TextWrapper(width=60, initial_indent='    ', subsequent_indent='    ')
        def on_status(self, status):
            try:
                print self.status_wrapper.fill(status.text)
                print '\n %s  %s  via %s\n' % (status.author.screen_name, status.created_at, status.source)
            except Exception, e:
                pass
    
    def main():
        l = StreamListener()
        streamer = tweepy.Stream(auth=auth1, listener=l, timeout=3000000000 )
        setTerms = ['hello', 'goodbye', 'goodnight', 'good morning']
        streamer.filter(None,setTerms)
    
    if __name__ == "__main__":
      main()
    

Does anyone know how to solve it?

Thanks...


Answer: The reason was SSL, it seems to be forced by twitter now...

