-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkwoot.py
32 lines (24 loc) · 868 Bytes
/
kwoot.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
# import the module
import tweepy
# Get the twitter credentials from a (hidden) file
secrets = open(".login")
login = secrets.readlines()
# assign the values accordingly
# strip the linebreak from the values to prevent bad login errors
consumer_key = login[0].rstrip('\n')
consumer_secret = login[1].rstrip('\n')
access_token = login[2].rstrip('\n')
access_token_secret = login[3].rstrip('\n')
# authorization of consumer key and consumer secret
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
# set access to user's access key and access secret
auth.set_access_token(access_token, access_token_secret)
# calling the api
api = tweepy.API(auth)
# Tweets opening text
quotetext = "Quote everyday!\n\n#wnw\n\n"
# Read, add and tweet the quotes:
kwoots = open("kwoots.txt")
for lines in kwoots:
tweet = quotetext + lines
api.update_status(tweet)