# return a random sample of your twitter followers
# run like so:
# $ python random_followers.py <screen_name>
# where <screen_name> is the account you want followers for
import sys, random, json, urllib
sname = sys.argv[1]
ids_raw = urllib.urlopen(
"https://api.twitter.com/1/followers/ids.json?screen_name="+sname).read()
follower_ids = json.loads(ids_raw)["ids"]
sampled = ','.join(random.sample([str(x) for x in follower_ids], 100))
followers_raw = urllib.urlopen(
"https://api.twitter.com/1/users/lookup.json?user_id=" + sampled).read()
followers = json.loads(followers_raw)
for follower in followers:
print follower["name"] + "\t" + "http://twitter.com/" + \
follower["screen_name"]