来自提及的Tweepy用户ID

Jos*_*nan 6 python twitter tweepy

我正在使用tweepy设置脚本来查找最新提到的用户名.从这里,我想检索推文的文本,以及他们的推特用户名.但是,我似乎无法检索实际的@用户名,只能检索他们的ID号.有什么建议?

以下是我的代码.问号是我需要正确语法的地方:

myMentions = tweepy.Cursor (api.mentions).items(1)

for mention in myMentions:
    statusText = mention.text
    statusUser = mention.????
Run Code Online (Sandbox Code Playgroud)

非常感谢!

ale*_*cxe 10

以下是最新tweepy版本对我有用的内容:

import tweepy

auth = tweepy.OAuthHandler(<consumer_key>, <consumer_secret>)
auth.set_access_token(<key>, <secret>)

api = tweepy.API(auth)

mentions = api.mentions_timeline(count=1)

for mention in mentions:
    print mention.text
    print mention.user.screen_name
Run Code Online (Sandbox Code Playgroud)

希望有所帮助.