Skip to content

Instantly share code, notes, and snippets.

@MacsInSpace
Created October 30, 2019 10:49
Show Gist options
  • Save MacsInSpace/9f02e8a34a3e9fea130fb8e45aaff74b to your computer and use it in GitHub Desktop.
Save MacsInSpace/9f02e8a34a3e9fea130fb8e45aaff74b to your computer and use it in GitHub Desktop.
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