I am using tweepy
to set up a script that finds the latest mention of my username. From this, I want to retrieve the text of the tweet, and their twitter user name. However, I don't seem to be able to retrieve the actual @ username, only their id number. Any suggestions?
Below is my code. The question marks are where I need the proper syntax:
myMentions = tweepy.Cursor (api.mentions).items(1)
for mention in myMentions:
statusText = mention.text
statusUser = mention.????
Thanks so much!
Here's what works for me with the most recent tweepy
version:
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
Hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With