-
Notifications
You must be signed in to change notification settings - Fork 911
Using The Client
Daniel Holmes edited this page Sep 12, 2015
·
1 revision
The oauth2.Client
is based on httplib2
and works just as you'd expect it to. The only difference is the first two arguments to the constructor are an instance of oauth2.Consumer
and oauth2.Token
(oauth2.Token
is only needed for three-legged requests).
import oauth2 as oauth
# Create your consumer with the proper key/secret.
consumer = oauth.Consumer(key="your-twitter-consumer-key",
secret="your-twitter-consumer-secret")
# Request token URL for Twitter.
request_token_url = "https://api.twitter.com/oauth/request_token"
# Create our client.
client = oauth.Client(consumer)
# The OAuth Client request works just like httplib2 for the most part.
resp, content = client.request(request_token_url, "GET")
print resp
print content