when I use tweepy api.get_user(id) it says

get_user() takes 1 positional argument but 2 were given

here’s my code
import tweepy
import keys
auth = tweepy.OAuthHandler(keys.consumer_key, keys.consumer_secret)
auth.set_access_token(keys.access_token, keys.access_token_secret)
api=tweepy.API(auth)

calling the api

api = tweepy.API(auth)

using get_user with id

_id = “103770785”
user = api.get_user(_id)

printing the name of the user

print("The id " + _id +
" corresponds to the user with the name : " +
user.name)

how to fix it and if not which liberariy with its documentation can I use to get favourite_counts of each user

The docs are here API — tweepy 4.10.1 documentation

I think if you have an ID, you should pass it as a number, not as a string, so

_id = 103770785
user = api.get_user(user_id=_id)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.