Guest User

Untitled

a guest
Jul 17th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. import tweepy
  2. from time import sleep
  3.  
  4. #key block might be good to make it in a separate file
  5. consumer_key = '' #
  6. consumer_secret = ''
  7. access_token = ''
  8. access_token_secret = ''
  9. screen_name = ''
  10.  
  11. auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
  12. auth.set_access_token(access_token, access_token_secret)
  13.  
  14. api = tweepy.API(auth)
  15.  
  16. # big loop of doom
  17. while True:
  18. public_tweets = api.user_timeline(screen_name, include_rts = False, count = 1)
  19. for tweet in public_tweets:
  20. try:
  21. tweet.retweet()
  22. print(tweet.id)
  23. except tweepy.TweepError as e:
  24. print(e)
  25. # old stuff that i dont need but i might one day
  26. #timeline = api.user_timeline(screen_name, include_rts = False)
  27. #lastTweetId = timeline[0].id
  28. #print (lastTweetId)
  29.  
  30. #public_tweets = api.user_timeline(screen_name , include_rts = False, since_id=lastTweetId)
  31. #lasttweet = api.user_timeline(screen_name, include_rts = False, count= 1)
  32. #print(lasttweet)
Add Comment
Please, Sign In to add comment