get_user(..)函数调用时无法加载附加信息

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

我遇到了类似的问题,但一直找不到解决方案。 api.get_user with Tweepy will not give description

我使用 tweepy (4.8.0) 和 auth 2.0 (bearer_token)

我尝试像这样使用 get_user(...) 加载用户信息

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

我希望在 user_fields 中获取额外的数据,但只传递了简单的基本数据。

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

也许我遗漏了什么或犯了错误?

救我...

我对这个问题的回答也适用于此。

来自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.