-
Notifications
You must be signed in to change notification settings - Fork 105
/
Copy pathmain.py
205 lines (152 loc) · 3.84 KB
/
main.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
import tweepy
import tkinter
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
user = api.me()
print(user.name)
for follower in tweepy.Cursor(api.followers).items():
follower.follow()
print("Followed everyonr that is following" + user.name)
root = Tk()
label1 = Label( root, text="Search")
E1 = Entry(root, bd =5)
label2 = Label( root, text="Number of Tweets")
E2 = Entry(root, bd =5)
label3 = Label( root, text="Response")
E3 = Entry(root, bd =5)
label4 = Label( root, text="Reply?")
E4 = Entry(root, bd =5)
label5 = Label( root, text="Retweet?")
E5 = Entry(root, bd =5)
label6 = Label( root, text="Favorite?")
E6 = Entry(root, bd =5)
label7 = Label( root, text="Follow?")
E7 = Entry(root, bd =5)
def getE1():
"""
Returns the first element of the first kind of the second.
Args:
"""
return E1.get()
def getE2():
"""
Get the 2 - tuple of two )
Args:
"""
return E2.get()
def getE3():
"""
Returns the e3 3d coefficient
Args:
"""
return E3.get()
def getE4():
"""
Returns the e4 value
Args:
"""
return E4.get()
def getE5():
"""
Returns the e5
Args:
"""
return E5.get()
def getE6():
"""
Returns the e6
Args:
"""
return E6.get()
def getE7():
"""
Returns the e7
Args:
"""
return E7.get()
def mainFunction():
"""
Main function.
Args:
"""
getE1()
search = getE1()
getE2()
numberOfTweets = getE2()
numberOfTweets = int(numberOfTweets)
getE3()
phrase = getE3()
getE4()
reply = getE4()
getE5()
retweet = getE5()
getE6()
favorite = getE6()
getE7()
follow = getE7()
if reply == "yes":
for tweet in tweepy.Cursor(api.search, search).items(numberOfTweets):
try:
#Reply
print('\nTweet by: @' + tweet.user.screen_name)
print('ID: @' + str(tweet.user.id))
tweetId = tweet.user.id
username = tweet.user.screen_name
api.update_status("@" + username + " " + phrase, in_reply_to_status_id = tweetId)
print ("Replied with " + phrase)
except tweepy.TweepError as e:
print(e.reason)
except StopIteration:
break
if retweet == "yes":
for tweet in tweepy.Cursor(api.search, search).items(numberOfTweets):
try:
#Retweet
tweet.retweet()
print('Retweeted the tweet')
except tweepy.TweepError as e:
print(e.reason)
except StopIteration:
break
if favorite == "yes":
for tweet in tweepy.Cursor(api.search, search).items(numberOfTweets):
try:
#Favorite
tweet.favorite()
print('Favorited the tweet')
except tweepy.TweepError as e:
print(e.reason)
except StopIteration:
break
if follow == "yes":
for tweet in tweepy.Cursor(api.search, search).items(numberOfTweets):
try:
#Follow
tweet.user.follow()
print('Followed the user')
except tweepy.TweepError as e:
print(e.reason)
except StopIteration:
break
submit = Button(root, text ="Submit", command = mainFunction)
label1.pack()
E1.pack()
label2.pack()
E2.pack()
label3.pack()
E3.pack()
label4.pack()
E4.pack()
label5.pack()
E5.pack()
label6.pack()
E6.pack()
label7.pack()
E7.pack()
submit.pack(side =BOTTOM)
root.mainloop()