'How to stop/close a Twitter API Filtered Stream after x seconds?
I just wanted to know how to stop a Twitter API Filtered Steam after x seconds.
I have got this so far:
t_end = time.time() + 10
while time.time() < t_end:
bearer_token = config.BEARER_TOKEN
headers = create_headers(bearer_token)
rules = get_rules(headers, bearer_token)
delete = delete_all_rules(headers, bearer_token, rules)
set = set_rules(headers, delete, bearer_token)
get_stream(headers, set, bearer_token)
print("ended")
However, the stream just continues. I cannot seem to find in the Twitter API documentation how to close a stream or ways to close a stream.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
