python-twitter
python-twitter copied to clipboard
GetUserRetweets & GetReplies don't properly filter UserTimeline
As it stands, GetUserRetweets and GetReplies don't filter out tweets in the GetUserTimeline endpoint to properly only return retweets and replies, respectively. So GetUserRetweets returns the UserTimeline including retweets, but also returns regular tweets made by the authenticating user.
According to the code:
- include_rts (bool, optional): If True, the timeline will contain native retweets (if they exist) in addition to the standard stream of tweets.
- exclude_replies (bool, optional) If True, this will prevent replies from appearing in the returned timeline. Using exclude_replies with the count parameter will mean you will receive up-to count tweets - this is because the count parameter retrieves that many tweets before filtering out retweets and replies. This parameter is only supported for JSON and XML responses.
So you can use:
timeline = api.GetUserTimeline(screen_name=screen_name, include_rts=False, exclude_replies=True)