SSl Error

396 views
Skip to first unread message

vineeth rakesh

unread,
Dec 25, 2011, 12:18:58 AM12/25/11
to twe...@googlegroups.com
I am using the following program for getting the streaming API of tweepy. But suddenly my program gets terminated due to SSL Error. The ssl error is very random some times my streaming api runs for 2 or 3 days some times it stops within few hours. Can some one help me with this?

The Streaming API I use is from the following link
https://github.com/ptwobrussell/Recipes-for-Mining-Twitter/blob/master/recipe__streaming_api.py

The error I get is as below.


Traceback (most recent call last):
  File "twitter_streaming_api_3_2.py", line 117, in <module>
    streaming_api.sample(count=None, async=None)
  File "/usr/local/lib/python2.7/dist-packages/tweepy-1.8-py2.7.egg/tweepy/streaming.py", line 195, in sample
    self._start(async)
  File "/usr/local/lib/python2.7/dist-packages/tweepy-1.8-py2.7.egg/tweepy/streaming.py", line 161, in _start
    self._run()
  File "/usr/local/lib/python2.7/dist-packages/tweepy-1.8-py2.7.egg/tweepy/streaming.py", line 118, in _run
    self._read_loop(resp)
  File "/usr/local/lib/python2.7/dist-packages/tweepy-1.8-py2.7.egg/tweepy/streaming.py", line 146, in _read_loop
    c = resp.read(1)
  File "/usr/lib/python2.7/httplib.py", line 541, in read
    return self._read_chunked(amt)
  File "/usr/lib/python2.7/httplib.py", line 574, in _read_chunked
    line = self.fp.readline(_MAXLINE + 1)
  File "/usr/lib/python2.7/socket.py", line 476, in readline
    data = self._sock.recv(self._rbufsize)
  File "/usr/lib/python2.7/ssl.py", line 232, in recv
    return self.read(buflen)
  File "/usr/lib/python2.7/ssl.py", line 151, in read
    return self._sslobj.read(len)
ssl.SSLError: The read operation timed out

Joshua Roesslein

unread,
Dec 29, 2011, 4:09:46 PM12/29/11
to twe...@googlegroups.com
Twitter requires you use SSL for streaming API. You are lucky it even works sometimes.

Joshua Roesslein

unread,
Dec 29, 2011, 4:12:05 PM12/29/11
to twe...@googlegroups.com
Sorry ignore that previous response, I didn't read your message close enough.
You are using SSL just fine it looks like, but it's running into an error when reading.
This could be from the other end closing the connection or some network error.
We may need to handle this better in Tweepy. You may just make your application
reconnect automatically and handle these errors gracefully.

On Saturday, December 24, 2011 at 11:18 PM, vineeth rakesh wrote:

https://github.com/ptwobrussell/Recipes-for-Mining-Twitter/blob/master/recipe__streaming_api.py

Reply all
Reply to author
Forward
0 new messages