forked from sd17spring/TextMining
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdata_finder.py
More file actions
52 lines (43 loc) · 1.53 KB
/
data_finder.py
File metadata and controls
52 lines (43 loc) · 1.53 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import twitter
import pickle
#who do you want to mimic
def data_finder(user_handle):
while True:
#data finder prompst the user to input login material
print ('consumer_key:')
c_k = input()
print ('consumer_secret:')
c_s = input()
print ('access_token_key:')
a_t_k = input()
print ('access_token_secret:')
a_t_s = input()
#data fider uses these to login
api = twitter.Api(consumer_key=c_k,
consumer_secret=c_s,
access_token_key=a_t_k,
access_token_secret=a_t_s)
# test to see if this brings an error if it doesnt break! if it does,
#try autenticating again
try:
api.VerifyCredentials()
break
except twitter.error.TwitterError as e:
print(e)
data_finder(user_handle)
# how do i make a list of lists of words from each tweet?
# How do i set up a login error that brings people back to the login option and works for more people than just me
# How do i save that list so i can open it in another progam
statuses = api.GetUserTimeline(screen_name=user_handle, count=850)
statuses = [s.text for s in statuses]
#print (statuses)
words = []
for status in statuses:
tweet = [status.split()]
words = words + tweet
statuses = words
return statuses
if __name__ == '__main__':
#import doctest
#doctest.testmod(verbose=True)
data_finder('pontifex')