53343

twitter retweet user id api python

using the twitter api with python, I need to know how to get all the user ids of all the people that retweeted a tweet.

I went here: https://dev.twitter.com/docs/api/1/get/statuses/%3Aid/retweeted_by

but I do not know how to put that into python.

here is my code so far:

from twitter import * t = Twitter(auth=OAuth(....)) twitter = t.statuses.user_timeline.snl() twitter[0]['text'] # gets the tweet twitter[0]['retweet_count'] # gets the number of retweets

what is my next line to get the IDs of all the users who retweeted?

Answer1:

You should use retweets_of_me for twitter API 1.1, retweeted_by is deprecated and doesn't work.

Here's an example:

from twitter import * t = Twitter(auth=OAuth(...)) tweets = t.statuses.user_timeline.snl() for tweet in tweets: retweets = t.statuses.retweets_of_me(since_id=str(tweet['id']), max_id=str(tweet['id'])) print retweets

Hope that helps.

Recommend

  • Why are the Twitter api calls so slow?
  • VBA Directory Referencing
  • How to parse XML file from a server?
  • Default value for Twitter's max_id Parameter?
  • Select distinct where date is max
  • How far back can I go with Facebook Graph API?
  • How do I move twitter configuration out of the controller? (Rails)
  • eVRC smart cards
  • Sending logo type image with text tweet in twitter
  • Handle Form Failure when uploading to Appengine Blobstore
  • Can I mix and match rel attributes?
  • Parsing json files
  • Facebook Messenger not showing up with UIActivityViewController
  • Slim PUT returns NULL
  • Forcing a webpage to fit into a webview
  • How to get automatic node ID from py2neo?
  • How to style the background of the parent element when hovering more then one child element?
  • How to get 15 columns in Bootstrap 4 in SASS CSS?
  • Backbone not defined with require js
  • Unable to authenticate with omniauth-instagram, client_id missing
  • Get all DNS records associated with an IP
  • jQuery-Marquee only working in Firefox
  • How do display a UIAlertView from a block on iOS?
  • OAuth2 flow for mobile app
  • How to reply a tweet using the Twitter gem?
  • Adjust width of select element according to selected option's width
  • Java: can you cast Class into a specific interface?
  • AES padding and writing the ciphertext to a disk file
  • Updating server-side rendering client-side
  • How to extract text from Word files using C#?
  • Do create extension work in single-user mode in postgres?
  • Why winpcap requires both .lib and .dll to run?
  • Return words with double consecutive letters
  • Circular dependency while pushing http interceptor
  • Python: how to group similar lists together in a list of lists?
  • Acquiring multiple attributes from .xml file in c#
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How can I remove ASP.NET Designer.cs files?
  • Busy indicator not showing up in wpf window [duplicate]
  • java string with new operator and a literal