]> jfr.im git - z_archive/twitter.git/commitdiff
yield Hangup and break on Stream SSLError (close #284)
authorRouxRC <redacted>
Mon, 4 Jan 2016 20:15:07 +0000 (21:15 +0100)
committerRouxRC <redacted>
Mon, 4 Jan 2016 20:15:07 +0000 (21:15 +0100)
twitter/stream.py

index f7c9419bd406269c0414b210721b20d3c1744a68..884cac948fc664c4fe047a1180b9bcee240fcab1 100644 (file)
@@ -173,7 +173,11 @@ class TwitterJSONIter(object):
 
         while True:
             # Decode all the things:
-            data = sock_reader.read()
+            try:
+                data = sock_reader.read()
+            except SSLError:
+                yield Hangup
+                break
             dechunked_data, end_of_stream, decode_error = chunk_decoder.decode(data)
             unicode_data = utf8_decoder.decode(dechunked_data)
             json_data = json_decoder.decode(unicode_data)