Last active
January 16, 2017 15:51
-
-
Save rocapp/74ea88a440040f4d03b8385c30db07cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def do_tweet(auth, tttw=10): | |
api = API(auth) # connect to Twitter using my authorization info | |
words = get_words('tweets.txt') # Get words from general tweets | |
words.extend(get_haikus('haiku.txt')) # Get previously written but un-tweeted haikus | |
words.extend(get_best('best.txt')) # Get list of "best" tweets | |
words.extend(get_words('search.txt')) # Get list of specifically searched terms | |
sdict = make_sdict(words) # Make a dictionary that maps words to their number of syllables | |
# Make a list of haikus and tweet them every 15 minutes | |
haik = list() | |
j = 0 | |
while j < tttw: | |
h = haiku(sdict).lower() | |
haik.append(h) | |
print(h) | |
api.update_status(h) | |
print("Tweeted! at %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime())) | |
time.sleep(900) | |
j+=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment