Skip to content

Filtered stream encountering HTTP error: 409 #1945

Answered by Harmon758
4RCAN3 asked this question in Questions
Discussion options

You must be logged in to vote

StreamRule expects a string.

stream.add_rules(tweepy.StreamRule(['@MyAccount is:reply'])) will return a Response with an error:

Response(data=None, includes={}, errors=[{'value': '["@MyAccount is:reply"]', 'details': ["Cannot parse rule at '[' (position 1)"], 'title': 'UnprocessableEntity', 'type': 'https://api.twitter.com/2/problems/invalid-rules'}], meta={'sent': '[ . . .]', 'summary': {'created': 0, 'not_created': 1, 'valid': 0, 'invalid': 1}})

I believe the 409 Conflict error occurs when you subsequently attempt to start the stream with no existing rules, since that rule was invalid and not created.

You can simply add the rule directly as a string instead, e.g. stream.add_rules(twee…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Harmon758
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question This is a question API This is regarding Twitter's API Documentation This is regarding the library's documentation Discussion This was converted/moved from/to a discussion
3 participants
Converted from issue

This discussion was converted from issue #1934 on August 19, 2022 15:39.