Created
November 11, 2017 14:45
-
-
Save gwuah/acabb5c59b2b883dd082c54feb174678 to your computer and use it in GitHub Desktop.
sample python snippet to retrieve all followers of a user using the tweepy wrapper
This file contains hidden or 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
import tweepy | |
API_KEY = '' | |
API_TOKEN = '' | |
ACCESS_TOKEN = '' | |
ACCESS_TOKEN_SECRET = '' | |
def authenticate(): | |
auth = tweepy.OAuthHandler(API_KEY, API_TOKEN) | |
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET) | |
return tweepy.API(auth) | |
api = authenticate() | |
followers = [] | |
user = api.get_user("gwuah_") | |
for user in user.followers(): | |
followers.append(user.screen_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment