Created
February 13, 2018 18:46
-
-
Save Jawn78/325941efe1732e5d4d191b2b0d417f7c to your computer and use it in GitHub Desktop.
Tweepy - Python API Code
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
import tweepy | |
auth = tweepy.OAuthHandler("Auth- Handler", "Auth Acces Handler") | |
# Redirect user to Twitter to authorize | |
redirect_user(auth.get_authorization_url()) | |
# Get access token | |
auth.get_access_token("verifier_value")// Access Token | |
# Construct the API instance | |
api = tweepy.API(auth) | |
# Iterate through all of the authenticated user's friends | |
for friend in tweepy.Cursor(api.friends).items(): | |
# Process the friend here | |
process_friend(friend) | |
# Iterate through the first 200 statuses in the friends timeline | |
for status in tweepy.Cursor(api.friends_timeline).items(200): | |
# Process the status here | |
process_status(status) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
where did you define the process_friend and process_status function?