1

I have recently taken over support for an app that uses rauth to connect to linkedin. The code that is failing is:

    self.linkedin= OAuth1Service(                                                     
        name='linkedin',                                                          
        consumer_key=self._consumer_key,                                              
        consumer_secret=self._consumer_secret,                                       
        request_token_url=self.request_token_url,      
        access_token_url=self.access_token_url,        
        authorize_url=self.authorize_url)          

    self.request_token, self.request_token_secret = \
                        self.linkedin.get_request_token(method='GET',
                        oauth_callback=self.callback_url)

The owner of the app says this used to work but now we're getting:

TypeError: request() got an unexpected keyword argument 'oauth_callback'

Can you point me to some doc/examples that would help me re-architect this?

-Jim

Jim Steil
  • 63
  • 3

1 Answers1

1

It sounds like you're using a later version of rauth than the original author was. You will need to amend the code to conform to the changes in the rauth API. These are mostly small, partly necessitated by the move to Requests v1.0.0 which had many breaking changes in its API.

You should read the upgrade guide. Additionally there's a number of working examples.

Finally this particular error is indicating that an unexpected parameter was passed in, namely oauth_callback. This is because rauth is just a wrapper over Requests. Requests doesn't know what to do with oauth_callback. Instead, you should use the native Requests' API and pass it in, in this case, via the params parameter, e.g.:

linkedin = OAuth1Service(name='linkedin',                                                          
                         consumer_key=consumer_key,                                              
                         consumer_secret=consumer_secret,                                       
                         request_token_url=request_token_url,      
                         access_token_url=access_token_url,        
                         authorize_url=authorize_url)          

request_token, request_token_secret = \
    linkedin.get_request_token(method='GET',
                               params={'oauth_callback': callback_url})

Hope that helps!

maxcountryman
  • 1,562
  • 1
  • 24
  • 51