web2py, OAuth and LinkedIn


I am new to Python and Web2py and I am developing an app that will use the LinkedIn API.

I use this library http://code.google.com/p/python-linkedin/ (it includes OAuth). My problem is very strange and that's why I am writing to the list.

When I try to connect to LinkedIn from the web2py console I get a request Token. When I do it inside a HTTP request I get a signature invalid exception.

The code I use in both cases is quite simple:

  li = LinkedIn(LINKEDIN_API_KEY, LINKEDIN_SECRET_KEY, URL(r=request, c='default',f='import_accounts'))
By : PanosJee


You mentioned that in both cases it is quite simple... it leaves me to wonder.

Is it the exact same code in both cases?

By : Gladius

I just tried and it works but: 1) make sure you run this on the same hostname that you registered with linkedin 2) pass a full RETURN_URL, not a relative URL as returned by URL

def index():
  import linkedin
  from linkedin import linkedin
  RETURN_URL = "http://web2py.com/linkedin/default/hello"
  api = linkedin.LinkedIn(KEY, SECRET, RETURN_URL)
  token = api.requestToken()
  return dict(message=T('Hello World'),token=token)
By : mdipierro

This video can help you solving your question :)
By: admin