GLHF GLHF - 8 months ago 109
Python Question

Tweepy mentions_timeline returns an empty list

I just started to make a Twitter Api. Normally I don't have a Twitter account, for this api I created one. I Tweeted 4 times, including some mentions. But when I use

like this;

my_mentions = api.mentions_timeline()
#output: []

After then I do a for loop on my_mentions with parameters
but nothing returned.

What I'm doing wrong here? Why it's an empty list since I mentioned some people in the tweets + how can I search mentions for another user? Is there a parameter in
object like


Try using the new Cursor Object as follows:

api = tweepy.API(auth)

for mentions in tweepy.Cursor(api.mentions_timeline).items():
    # process mentions here
    print mentions.text

as per Twitters documentation here

Returns the 20 most recent mentions (tweets containing a users’s @screen_name) for the authenticating user.

so you cannot check other users mentions using this method. To achieve this, you will have to uses twitters search api. for tweepy's documentation check here