]> www.vanbest.org Git - tweet-django-debian/commitdiff
Exit streamrunner when twitter api keys not specified or not correct; make runstream... upstream v1.1
authorJan-Pascal van Best <janpascal@vanbest.org>
Thu, 18 Feb 2016 20:48:54 +0000 (21:48 +0100)
committerJan-Pascal van Best <janpascal@vanbest.org>
Thu, 18 Feb 2016 20:48:54 +0000 (21:48 +0100)
runstream.py [changed mode: 0644->0755]
tweet/streamrunner.py

old mode 100644 (file)
new mode 100755 (executable)
index 0b75fe36924083812c86fc23c3b8ba047f44fc66..8063a87c69412ac13eef1632f1291af52fc60a5d 100644 (file)
@@ -37,6 +37,10 @@ class Streamer(TwythonStreamer):
 
     def on_error(self, status_code, data):
         logger.info("Stream error: {}, {}".format(status_code, data))
+        if status_code == 401:
+            logger.error("Twitter authentication error, bailing out...")
+            time.sleep(10)
+            close_stream()
         if status_code == 420:
             logger.warning("Stream rate limited, sleeping for 90 seconds...")
             time.sleep(90)