'When the get_user(..) function is called, additional information cannot be loaded

I'm having a similar problem, but I haven't been able to find a solution. api.get_user with Tweepy will not give description

I use tweepy (4.8.0) and auth 2.0 (bearer_token)

I tried to load user information by using get_user(...) like this

client = tweepy.Client(
    bearer_token=bearer_token
)
result = client.get_user(username="name", user_fields=['created_at'])

I expected to get additional data put in the user_fields, but only simple basic data was passed.

Response(data=<User id=1234 name=NAME username=name>, includes={}, errors=[], meta={})

Maybe I'm missing something or made a mistake?

save me plz...



Solution 1:[1]

My answer to that question applies here as well.

From the relevant FAQ section in Tweepy's documentation:

Why am I not getting expansions or fields data with API v2 using Client?

If you are simply printing the objects and looking at that output, the string representations of API v2 models/objects only include the default attributes that are guaranteed to exist.

The objects themselves still include the relevant data, which you can access as attributes or by key, like a dictionary.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Harmon758