Skip to content

Instantly share code, notes, and snippets.

@saurabhwahile
Created September 12, 2016 18:20
Show Gist options
  • Save saurabhwahile/743b8a8236170d5102dd27ab0fb87fa5 to your computer and use it in GitHub Desktop.
Save saurabhwahile/743b8a8236170d5102dd27ab0fb87fa5 to your computer and use it in GitHub Desktop.
Mass unfollow on twitter
import tweepy
auth = tweepy.auth.OAuthHandler(
consumer_key="key",
consumer_secret="secret")
auth.set_access_token(
'token',
'secret')
api=tweepy.API(auth_handler=auth)
unfollow_list = [
#list of csv user-ids
]
for u in unfollow_list:
print u
try:
u = api.get_user(u)
except tweepy.error.TweepError, e:
if e.api_code == 50:
continue
else:
print e.message
break
print u.screen_name
print u.unfollow()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment