2016-05-09 5 views
0

Meine Anwendung (Python3 + Tweepy) findet ein Hashtag und retweet es. Ich bekomme einen "Retweet ist nicht zulässig für diesen Status" -Fehler, weil ich eigene Tweets retweete.Eigene Retweets filtern Tweepy

Wie herauszufiltern?

# retweet function 
def hashtag_Retweet():  
    print (tweet.id) 
    api.retweet(tweet.id) # retweet 
    print(tweet.text) 
    return 

query = '#foosball' 
our_own_id = '3678887154' #Made up for this post 
tweets = api.search(query) 
for tweet in tweets: 
# make sure that tweet does not come from host  
    hashtag_Retweet() 

Antwort

1

So etwas würde funktionieren.

for tweet in tweets: 
    if tweet.user.id != our_own_id:  
     hashtag_Retweet() 

Ich hoffe, es hilft.