]> jfr.im git - z_archive/twitter.git/commit
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)
commit89f30c21b39702d330070ed54d2d82377501f472
tree2666547dfca670b42609252b5a8c5b7fd383f304
parent3f6ca83dfc697b71974d2fa3b10b4e68c4d4c621
parentf560656d5b2e57c6d264d073566848fd71c9000e
Merge pull request #205 from sixohsix/stream_cleanup

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.