twitools/followertxt.py
Klaus-Uwe Mitterer 0c16692f1e Add followertxt to twitools
Modify followertxt such as to use credentials from config
Move followertxt's paginate() function to tools
2015-05-17 21:33:25 +02:00

20 lines
440 B
Python
Executable file

#!/usr/bin/env python3
import config, tools
import tweepy
outfile = "followers.txt"
auth = tweepy.OAuthHandler(config.cke, config.cse)
auth.set_access_token(config.ato, config.ase)
api = tweepy.API(auth)
follower_ids = api.followers_ids()
with open(outfile, 'a') as f:
for page in tools.paginate(follower_ids, 100):
followers = api.lookup_users(user_ids=page)
for follower in followers:
f.write(follower.screen_name + "\n")