forked from tweepy/tweepy
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request tweepy#123 from nloadholtes/nloadholtes-examples
A new example of how to use oauth
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import tweepy | ||
|
||
# == OAuth Authentication == | ||
# | ||
# This mode of authentication is the new preferred way | ||
# of authenticating with Twitter. | ||
|
||
# The consumer keys can be found on your application's Details | ||
# page located at https://dev.twitter.com/apps (under "OAuth settings") | ||
consumer_key="" | ||
consumer_secret="" | ||
|
||
# The access tokens can be found on your applications's Details | ||
# page located at https://dev.twitter.com/apps (located | ||
# under "Your access token") | ||
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) | ||
|
||
# If the authentication was successful, you should | ||
# see the name of the account print out | ||
print api.me().name | ||
|
||
# If the application settings are set for "Read and Write" then | ||
# this line should tweet out the message to your account's | ||
# timeline. The "Read and Write" setting is on https://dev.twitter.com/apps | ||
api.update_status('Updating using OAuth authentication via Tweepy!') |