sixohsix/twitter — pull request #205 by sixohsix (2014-02-18 01:06:00+00:00)
Title: 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`.

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.

@adonoho and @RouxRC, I'm sure you're sick of me by now, but if you have any particular tests you'd like to run, or comments, please let me know.