2

I'm having some SSL error when trying to connect to the Twitter Streaming API using Tweepy package. I read about about SSL certificates not being valid, but I couldn't solve the problem. What is weird is that sometimes it works fine, and sometimes it doesn't, without even touching to the code. Here is my error log:

File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tweepy/streaming.py", line 299, in filter
    self._start(async)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tweepy/streaming.py", line 236, in _start
    self._run()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tweepy/streaming.py", line 157, in _run
    conn.connect()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1176, in connect
    self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 387, in wrap_socket
    ciphers=ciphers)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 143, in __init__
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 305, in do_handshake
    self._sslobj.do_handshake()
SSLError: [Errno 8] _ssl.c:507: EOF occurred in violation of protocol

I'm using the typical way to connect :

# Authentification
auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token (access_token, access_token_secret)

# Connecting to the stream
twitterStream = Stream (auth, twitterListener())
twitterStream.filter(track=['someWord'])

Thanks a lot !

tomasyany
  • 1,132
  • 3
  • 15
  • 32
  • 2
    Maybe this one helps: http://stackoverflow.com/questions/14102416/python-requests-requests-exceptions-sslerror-errno-8-ssl-c504-eof-occurred – dorvak Apr 18 '14 at 14:22
  • 1
    Yup, ssl.wrap_socket() is being called. My answer would help. :) – chnrxn Feb 25 '15 at 14:59

0 Answers0