From 4b0242c6c2d5d26b0aa94243326f28757a459784 Mon Sep 17 00:00:00 2001 From: Nick Loadholtes Date: Sat, 8 Oct 2011 14:49:45 -0400 Subject: [PATCH] A new example of how to use oauth --- examples/oauth.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 examples/oauth.py diff --git a/examples/oauth.py b/examples/oauth.py new file mode 100644 index 0000000..d3b4b10 --- /dev/null +++ b/examples/oauth.py @@ -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!') -- 2.25.1