geduldig / TwitterAPI

Minimal python wrapper for Twitter's REST and Streaming APIs
935 stars 263 forks source link

StreamingAPI Get all @Mentions returns TwitterRequestError 406 #75

Closed DeastinY closed 8 years ago

DeastinY commented 8 years ago

I am trying to get all @ mentions, but

for msg in api.request('statuses/filter', {'replies': 'all'}):

returns a

TwitterAPI.TwitterError.TwitterRequestError: Twitter request failed (406)

I looked at the Twitter API but could not see any general usage errors.

Twitter documentation:

By default @replies are only sent if the current user follows both the sender and receiver of the reply. For example, consider the case where Alice follows Bob, but Alice doesn’t follow Carol. By default, if Bob @replies Carol, Alice does not see the Tweet. This mimics twitter.com and api.twitter.com behavior. To have such Tweets returned in a streaming connection, specify replies=all when connecting.

geduldig commented 8 years ago

This is because replies=all only works with user and site streams but not filter streams. In the documentation, the line just above your quote says: "Available on GET user and GET site."

DeastinY commented 8 years ago

Thanks a bunch for the super fast reply !

DeastinY commented 8 years ago

Just for completeness: api.request('user', {'replies': 'all'})