-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.py
38 lines (29 loc) · 998 Bytes
/
index.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
33
34
35
36
37
import tweepy, time, sys, codecs
from statics import INTERVAL, INTERVAL_TEST
from credentials import *
# keep the quotes, replace this with your consumer key
CONSUMER_KEY = CONSUMER_KEY
# keep the quotes, replace this with your consumer secret key
CONSUMER_SECRET = CONSUMER_SECRET
# keep the quotes, replace this with your access token
ACCESS_KEY = ACCESS_KEY
# keep the quotes, replace this with your access token secret
ACCESS_SECRET = ACCESS_SECRET
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
api = tweepy.API(auth)
filename = codecs.open('test', 'r', 'utf-8')
f = filename.readlines()
filename.close()
string = ''
for line in f:
if string == '':
string = line
continue
if line != 'end' and string != '' and line != 'next\n':
string += '\n' + line
continue
if line == 'next\n' or line == 'end':
api.update_status(string)
string = ''
time.sleep(INTERVAL)