Twitter-API-v2-sample-code
Twitter-API-v2-sample-code copied to clipboard
Filtered stream example can cause 429 error
Describe the bug
The example code for filtered streams (python) does not properly close the stream. Upon using this code repeatedly it is possible to open many streams past your limit, and not be able to disconnect them. This can lock you out of using the Twitter filtered stream API for however long it takes the twitter server to disconnect the streams.
I have been currently been locked out for a day, and receive this response every time I try to reconnect.
'{"title":"ConnectionException","detail":"This stream is currently at the maximum allowed connection limit.","connection_issue":"TooManyConnections","type":"https://api.twitter.com/2/problems/streaming-connection"}'
To Reproduce Run example code multiple times until you receive the 429 error.
Expected behavior Example code should include a disconnect, so that developers are aware of this possibility. Or a way to force the twitter server to disconnect all current open connections should be released.
Additional context Add any other context about the problem here.