Created
October 30, 2019 10:49
-
-
Save MacsInSpace/9f02e8a34a3e9fea130fb8e45aaff74b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 tweepy | |
from tweepy import API | |
auth = tweepy.OAuthHandler("CONSUMER_KEY", "CONSUMER_SECRET") | |
auth.set_access_token("ACCESS_TOKEN", "ACCESS_TOKEN_SECRET") | |
api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True, compression=True) | |
path = '/location/for/list/file_with_name_list.txt' | |
with open(path, 'r') as f: | |
for line in f: | |
try: | |
api.add_list_member(slug = 'my_listname', screen_name = line, owner_screen_name = 'my_username') | |
except: | |
pass | |
close() | |
path = '/location/for/blocklist.csv' | |
with open(path, 'r') as f: | |
for line in f: | |
try: | |
api.create_block(line) | |
except: | |
pass | |
close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment