Skip to content

Commit

Permalink
fix: manage_rules & example streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
erwanvivien committed Nov 19, 2021
1 parent 76a66b4 commit 0593c70
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions examples/search_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ def on_tweet(self, tweet):


if __name__ == "__main__":
# Application should be
stream = MySearchStream(bearer_token=bearer_token)

# create new rules
add_rules = {
{
"add": [
{"value": "cat has:media", "tag": "cats with media"},
{"value": "cat has:media -grumpy", "tag": "happy cats with media"},
]
}
"add": [
{"value": "cat has:media", "tag": "cats with media"},
{"value": "cat has:media -grumpy", "tag": "happy cats with media"},
]
}

# validate rules
stream.manage_rules(rules=add_rules, dry_run=True)

# create rules
# Rules remain after creating them, check them using stream.get_rules(return_json=True)
stream.manage_rules(rules=add_rules)
# Response(data=[StreamRule(id='1370406958721732610', value='cat has:media -grumpy'), StreamRule(id='1370406958721732609', value='cat has:media')])

Expand Down
2 changes: 1 addition & 1 deletion pytwitter/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def get_rules(
)

def manage_rules(
self, rules: Optional[Set[Dict[str, List]]], dry_run=False, return_json=False
self, rules: Optional[Dict[str, List]], dry_run=False, return_json=False
):
"""
Add or delete rules to your stream.
Expand Down

0 comments on commit 0593c70

Please sign in to comment.