Last active
December 16, 2015 10:39
-
-
Save abelsonlive/5421242 to your computer and use it in GitHub Desktop.
connect with twitter's api in python via tweepy
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 | |
# api keys accessed from http://dev.twitter.com/apps | |
auth = tweepy.OAuthHandler(consumer_key, consumer_secret) | |
auth.set_access_token(access_token, access_token_secret) | |
api = tweepy.API(auth) | |
# now you can do stuff like this: | |
# get my last 20 tweets | |
my_tweets = api.user_timeline("brianabelson") | |
# these are formatted as a list of dictioaries | |
print my_tweets[0] | |
# tweet from python! (only works if your account is set to "read/write") | |
api.update_status("I'm tweetin from python, yo!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment