1 # Make a "famous ratio" for a given user which I'll define as 'number
2 # of followers a person has divided by number of people they
3 # follow. Try out @makoshark, and @pontifex (the Pope). Who is higher?
7 from twitter_authentication import CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET
9 auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
10 auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
12 api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True)
14 def famous_ratio(username):
15 user = api.get_user(username)
16 return(user.followers_count / user.friends_count)
18 print("mako: %s" % famous_ratio('makoshark'))
19 print("the pope: %s" % famous_ratio('pontifex'))