How to change stream track? #1339
-
I would like to change the stream track dynamically without losing any message. What's the best method for changing the track of a stream? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You must stop and restart the stream. If you want to do this in a script, using https://michaelcurrin.github.io/python-twitter-guide/#/code_snippets?id=update-stream |
Beta Was this translation helpful? Give feedback.
-
Twitter's API does not include a way to change tracks dynamically for the same standard stream:
https://developer.twitter.com/en/docs/tweets/filter-realtime/overview As of right now, you'll have to use the enterprise PowerTrack API if you want to use a non-Labs endpoint to do so. Otherwise, you'll have to create a new stream with the new track, as explained. |
Beta Was this translation helpful? Give feedback.
Twitter's API does not include a way to change tracks dynamically for the same standard stream:
https://developer.twitter.com/en/docs/tweets/filter-realtime/overview
As of right now, you'll have to use the enterprise PowerTrack API if you want to use a non-Labs endpoint to do so.
Otherwise, you'll have to create a new stream with the new track, as explained.
I'd recommend using
stream.disconnect
rather than manually modifyingstream.running
though.See also the Missing data from disconnections section of the documentation for consuming streaming data.