Search code examples
pythonapitwittercompiler-errorstweets

python twitter api 1.1 get retweet id


I need to print the ids of users that have re-tweeted a tweet. when I run my code, this is what I get. what am I doing wrong?

reqs()

[]

[]

[]

[]

[]

[]

[]

[]

[]

[]

[]

[]

[]

[]

[]

Traceback (most recent call last): File "", line 1, in reqs() File "C:\Documents and Settings\visolank\Desktop\Python\programs\twitter_travel_guard.py", line 136, in reqs retweets = t.statuses.retweets_of_me(since_id=str(tweet['id']), max_id=str(tweet['id'])) File "C:\Documents and Settings\visolank\Desktop\Python\programs\twitter\api.py", line 204, in call return self._handle_response(req, uri, arg_data, _timeout) File "C:\Documents and Settings\visolank\Desktop\Python\programs\twitter\api.py", line 235, in _handle_response raise TwitterHTTPError(e, uri, self.format, arg_data) TwitterHTTPError: Twitter sent status 429 for URL: 1.1/statuses/retweets_of_me.json using parameters: (max_id=345206977242210304&oauth_consumer_key=...&oauth_nonce=...&oauth_signature_method=...&oauth_timestamp=1371498240&oauth_token=...&oauth_version=1.0&since_id=345206977242210304&oauth_signature=m...) details: {"errors":[{"message":"Rate limit exceeded","code":88}]}

code:

def reqs():
    t = Twitter(auth=OAuth('....'))
    tweets = t.statuses.user_timeline.TravelGuard()
    for tweet in tweets:
        retweets = t.statuses.retweets_of_me(since_id=str(tweet['id']), max_id=str(tweet['id']))
        print retweets

Solution

  • use retweeters

    instead. boom figured it out myself