Created
August 11, 2013 05:57
-
-
Save rhema/6203589 to your computer and use it in GitHub Desktop.
With keys redacted
This file contains 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
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