-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathremove200blank.py
34 lines (31 loc) · 1.02 KB
/
remove200blank.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
import tweepy
import time, random
#Twitter OAuth - From Twitter 'apps'
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)
#Call Tweepy api instance
api = tweepy.API(auth, wait_on_rate_limit='true')
count = 1
for line in tweepy.Cursor(api.friends).items():
if count < 200:
description = line.description
if description != '':
print('Not blank!')
time.sleep(1)
elif description == '':
sleep_timer = (random.randint(15, 40))
screen_name = line.screen_name
api.destroy_friendship(screen_name)
print(str(count) + ". " + "Removed " + str(screen_name) + " from friends. "
+ "Sleeping for " + str(sleep_timer) + " seconds.")
count = count+1
time.sleep(sleep_timer)
else:
pass
if count == 200:
print("Stopping...")
quit()