Skip navigation

I updated my Python Oauth Client Library so that it actually works now!

Here’s an example of how to use it:

EXAMPLE

(using Twitter)

def myCallback ( data ):
  print "data: %s" % data

c = oauthConsumer.Client( consumerKey, consumerSecret, requestTokenURL, accessTokenURL, authorizeURL, "http://example.com/check" )
c.requestAuth( myCallback )
#data: https://twitter.com/oauth/authorize?oaut..
c.requestSession( oauth_token, oauth_verifier, myCallback )
#data: oauth_token=20687908-snoIXOqT7StBdYtyeatV0fAzxLTB0DYklIgBh8klx&o...
print c._sessionSecret
#'hPxakZ3tztpiFaxulcHK9VfkCiJ4PIsL40mc9tfw'
print c._sessionToken
#'20687908-snoIXOqT7StBdYtyeatV0fAzxLTB0DYklIgBh8klx'

Now make requests via createRequest

update = c.createRequest( path="/statuses/update.json", callback=myCallback)
update.post(params = { "status":"testing pyoauthconsumer oauth client python library I'm working on" } )
#data: {"truncated":false, ... }

You can see the post made with this example here.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: