Retweeters of a Twitter status in Tweepy

python, tweepy, twitter

Solution

`retweeted_by` is not a part of 1.1 twitter API. Switch to `retweets`:

results = api.retweets(firstTweet.id)

FYI, quote from docs:

GET statuses/retweeters/ids

Returns a collection of up to 100 user IDs belonging to users who have retweeted the tweet specified by the id parameter.

This method offers similar data to GET statuses/retweets/:id and replaces API v1's GET statuses/:id/retweeted_by/ids method.

Problem

This is kindof a followup question to this question. I want to get the ID of the users that have retweeted a particular tweet. I tried following the same technique but I'm getting an error. Here's the code: ``` import tweepy auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_token(ACCESS_KEY, ACCESS_SECRET) api = tweepy.API(auth) firstTweet = api.user_timeline("github")[0] print firstTweet.text print firstTweet.id results = api.retweeted_by(firstTweet.id) print results ``` This returns the 1st tweet and also the tweet ID. It then gives me the following error: ``` Traceback (most recent call last): File "twitter_test.py", line 21, in <module> results = api.retweeted_by("357237988863913984") File "/usr/local/lib/python2.7/dist-packages/tweepy-2.1-py2.7.egg/tweepy/binder.py", line 197, in _call return method.execute() File "/usr/local/lib/python2.7/dist-packages/tweepy-2.1-py2.7.egg/tweepy/binder.py", line 173, in execute raise TweepError(error_msg, resp) tweepy.error.TweepError: [{u'message': u'Sorry, that page does not exist', u'code': 34}] ```

Original source