Skip to content

Instantly share code, notes, and snippets.

@rhema
Created August 11, 2013 05:57
Show Gist options
  • Save rhema/6203589 to your computer and use it in GitHub Desktop.
Save rhema/6203589 to your computer and use it in GitHub Desktop.
With keys redacted
from twython import Twython, TwythonError
import time
APP_KEY = ""#aka Consumer key
APP_SECRET = ""#aka Consumer secret
OAUTH_TOKEN = "16279554-"# aka Access token
OAUTH_TOKEN_SECRET = ""# aka Access token secret
user_timeline = None
twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
twitters = open("whitelist.txt").readlines()
outfile = open("following.txt","a")
for tw in twitters:
try:
print tw
tw = tw.strip()
following = twitter.get_friends_ids(screen_name=tw)
print following
following_strs = []
for f in following['ids']:
following_strs+=[str(f)]
outfile.write(",".join([tw]+following_strs)+"\n")
outfile.flush()
time.sleep(60)
except TwythonError as e:
print e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment