made a collection of twitter api solutions
[twitter-api-cdsw-solutions] / solution-followers-1.py
diff --git a/solution-followers-1.py b/solution-followers-1.py
new file mode 100644 (file)
index 0000000..d200ed2
--- /dev/null
@@ -0,0 +1,16 @@
+# Q Write a program to find out how many people a particular user follows?
+
+import encoding_fix
+import tweepy
+from twitter_authentication import CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET
+
+auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
+auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
+
+api = tweepy.API(auth)
+
+user = api.get_user('makoshark')
+
+print(user.screen_name + " follows " + str(user.friends_count) + " accounts.")
+
+

Benjamin Mako Hill || Want to submit a patch?