Tweepy does not include retweets in user_timeline by default, so tweet.retweeted will always be false. To enable retweets, you can specify include_rts as True, for example
tweets= api.user_timeline(id=user['id'], count=30,include_rts=True) for tweet in tweets: if not tweet.retweeted: analyze_tweet(tweet) else:
source share