clean rules first
This commit is contained in:
parent
1eb5f84cc0
commit
30615db063
1 changed files with 5 additions and 4 deletions
9
main.py
9
main.py
|
@ -331,12 +331,13 @@ def start():
|
||||||
stream = Listener(keys["BEARER_TOKEN"], client)
|
stream = Listener(keys["BEARER_TOKEN"], client)
|
||||||
|
|
||||||
# Clean rules
|
# Clean rules
|
||||||
for rule in stream.get_rules().data:
|
old_rules = stream.get_rules()
|
||||||
stream.delete_rules(rule.id)
|
if (old_rules.data):
|
||||||
|
stream.delete_rules([rule for rule in old_rules.data])
|
||||||
|
|
||||||
# Add new rules
|
# Add new rules
|
||||||
for rule in create_rules(tracked_users):
|
stream.add_rules([StreamRule(rule)
|
||||||
stream.add_rules(StreamRule(rule))
|
for rule in create_rules(tracked_users)])
|
||||||
stream.filter(threaded=True, tweet_fields=['author_id'])
|
stream.filter(threaded=True, tweet_fields=['author_id'])
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue