Advertisement
Guest User

Twitter Bot

a guest
Jul 24th, 2016
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. #Basic Twitter Bot
  2. #By Brandon Hammond
  3.  
  4. import os
  5. import sys
  6. import time
  7. import tweepy
  8.  
  9. from time import sleep
  10.  
  11. x = 60
  12.  
  13. #Authenticate with Twitter API
  14. #Change text in caps to values given by Twitter API
  15. auth = tweepy.OAuthHandler("CONSUMER KEY", "CONSUMER SECRET")
  16. auth.set_access_token("ACCESS TOKEN", "ACCESS TOKEN SECRET")
  17. api = tweepy.API(auth)
  18.  
  19. #Open file containing Tweets (Tweets are seperated by new line)
  20. f = open("tweets.txt", "w")
  21.  
  22. while True:
  23.     #Repeat forever
  24.     content = f.readline()
  25.     if content == "":
  26.         #If at end of file
  27.         f.seek(0)
  28.         api.update_status(content)
  29.     else:
  30.         #If still in file
  31.         api.update_status(content)
  32.     sleep(X) #Change X to wanted time in seconds
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement