-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtwitter_bot.py
32 lines (25 loc) · 855 Bytes
/
twitter_bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#
# talks to the Verbal Infusions Twitter account
# Author: Emily Quinn Finney
#
import tweepy
import create_status as cs
def authenticate_bot(filename):
"""
Authenticates the Twitter Bot
:return: nothing, but should write the data from the HTTP request to file
"""
with open(filename, 'r') as f:
d = f.readlines()
api_key = d[0].strip()
api_secret = d[1].strip()
access_token = d[2].strip()
access_secret = d[3].strip()
authentication = tweepy.OAuthHandler(api_key, api_secret)
authentication.set_access_token(access_token, access_secret)
return authentication
if __name__ == "__main__":
auth = authenticate_bot('vi.keys')
VerbalInfusions = tweepy.API(auth)
#import ipdb; ipdb.set_trace()
VerbalInfusions.update_status(cs.markov_tweet('tea_description.txt'))