Last active
May 20, 2017 23:08
-
-
Save avarx/f2940ca7b672cf75152acee024df6d47 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import twitter | |
ACCESS_KEY = 'xxxx' | |
ACCESS_SECRET = 'xxxx' | |
CONSUMER_KEY = 'xxxx' | |
CONSUMER_SECRET = 'xxxx' | |
t = twitter.Twitter(auth=twitter.OAuth(ACCESS_KEY, ACCESS_SECRET, CONSUMER_KEY, CONSUMER_SECRET)) | |
def twitter_block_user(screen_name): | |
try: | |
blocked = t.blocks.create(screen_name=screen_name) | |
if blocked: | |
print ("Blocked user: [ @%s ]." % screen_name) | |
else: | |
print ("Could not block: [ @%s ]." % screen_name) | |
except Exception: | |
pass | |
with open('blocklist') as fp: | |
for line in fp: | |
twitter_block_user(line.rstrip()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment