Hantian Zhang
Hantian Zhang

Reputation: 1

Pyphon Tweepy api.get_user doesn't work

could anyone tell me what is wrong with my Pyphon code here? I am trying to use the get_user api by tweepy cursor, but it keeps telling me "this method does not perform pagination" But if I use user_timeline, it works perfectly fine.

Here is my code

for twitter in tweepy.Cursor(api.get_user, user_id="xxx", screen_name="xxx").items():
      print(twitter.text)

Thank you so much!

Upvotes: 0

Views: 2693

Answers (1)

Joe Mayo
Joe Mayo

Reputation: 7513

The get_user API is for a single person, rather than a timeline. You can use it like this:

tweet = api.get_user(screen_name="JoeMayo")
print("Most recent tweet: " + tweet.status.text)

You don't need all 3 parameters, either an user_id or screen_name. Also, and you would have probably seen this, the most recent tweet is tweet.status.text, rather than tweet.text.

Upvotes: 1

Related Questions