Skip navigation

Tag Archives: oauth

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.