TerenceMcKennaTwitterBot
Revision as of 18:02, 7 December 2013 by Δεριζαματζορπρομπλεμιναυστραλια (talk | contribs)
The code connects with twitter account, opens the text file, reads all the lines as a list
and for each list creates a tweet every 1 minute.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tweepy, time, sys
#enter the corresponding information from your Twitter application:
CONSUMER_KEY = 'y0Wr2HY0I990k9qPFSQdCg'
CONSUMER_SECRET = 'blJLnPrHsJezC2rUVXKi7WzlSJhZIcdhrOCjzSUHLs'
ACCESS_KEY = '2159389034-bth62Bn6He5c85uIdmsPynF5UaHPrlUbEZJOhmK'
ACCESS_SECRET = 'IyE44Bflm7OrdU8yUFqTGv3Dv2TV8fT08ISxnaUQo3r6L'
# setup the twitter connection...
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
api = tweepy.API(auth)
# Here we go...
argfile = str(sys.argv[1])
# open the file
filename=open(argfile,'r')
# read all the lines as a big list
f=filename.readlines()
filename.close()
# for every line in the file...
for line in f:
line = line.strip()
api.update_status(line)
time.sleep(1*60)#Tweet every 15 minutes