]> jfr.im git - z_archive/twitter.git/commitdiff
Merge pull request #205 from sixohsix/stream_cleanup
authorMike Verdone <redacted>
Sun, 9 Mar 2014 21:11:15 +0000 (22:11 +0100)
committerMike Verdone <redacted>
Sun, 9 Mar 2014 21:11:15 +0000 (22:11 +0100)
Explicit support for heartbeat handling
Yet another crack at the stream iterator.

Now we explicitly track timeouts and heartbeat timeouts separately. Regular timeouts produce `Timeout` tokens (dicts). Heartbeat timeouts produce `HeartbeatTimeout` and StopIteration if iterated again. This is a solid fix for issue #202.

If the stream is set to use `timeout=None, block=False`, then we yield only data or `None`. If `timeout` is set to a number, we yield data or `Timeout` tokens, never `None`. If we are set to `block=True` then we yield only data.

Also: improve the documentation and remove some code weirdness.

Also: make the example stream program highly configurable to test every bizarre combination from the command line.

twitter/oauth_dance.py

index 17dbae6f44fce9981a6c7f768d53ceff8a23dc29..d3f0ea8f6548635a5c93d6c832f160bb0d5f5cf3 100644 (file)
@@ -1,4 +1,3 @@
-
 from __future__ import print_function
 
 import webbrowser
@@ -38,7 +37,7 @@ In the web browser window that opens please choose to Allow
 access. Copy the PIN number that appears on the next page and paste or
 type it here:
 """)
-    oauth_url = ('http://api.twitter.com/oauth/authorize?oauth_token=' +
+    oauth_url = ('https://api.twitter.com/oauth/authorize?oauth_token=' +
                  oauth_token)
     print("Opening: %s\n" % oauth_url)