Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tweepy
- from time import sleep
- #key block might be good to make it in a separate file
- consumer_key = '' #
- consumer_secret = ''
- access_token = ''
- access_token_secret = ''
- screen_name = ''
- auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
- auth.set_access_token(access_token, access_token_secret)
- api = tweepy.API(auth)
- # big loop of doom
- while True:
- public_tweets = api.user_timeline(screen_name, include_rts = False, count = 1)
- for tweet in public_tweets:
- try:
- tweet.retweet()
- print(tweet.id)
- except tweepy.TweepError as e:
- print(e)
- # old stuff that i dont need but i might one day
- #timeline = api.user_timeline(screen_name, include_rts = False)
- #lastTweetId = timeline[0].id
- #print (lastTweetId)
- #public_tweets = api.user_timeline(screen_name , include_rts = False, since_id=lastTweetId)
- #lasttweet = api.user_timeline(screen_name, include_rts = False, count= 1)
- #print(lasttweet)
Add Comment
Please, Sign In to add comment