ozgur/python-linkedin — pull request #12 by ptwobrussell (2013-05-27 23:00:02+00:00)
Title: Implements LinkedInDeveloperAuthentication class

Implemented LinkedInDeveloperAuthentication class that stores the 4 credentials necessary for an OAuth 1.0a flow and modified LinkedInApplication to use requests_oauthlib to do all of the heavy lifting in enabling the OAuth 1.0a flow that requires no redirects or user intervention in the event that it is passed a LinkedInDeveloperAuthentication instance. Very useful for situations in which users just want to access their own data or when developers are testing. Have not updated the README docs yet

@ozgur - Please consider accepting this pull request. I think you'll find that it's quite nice.

Sample usage:

# Define CONSUMER_KEY/SECRET and USER_TOKEN/SECRET
# from credentials in your LinkedIn application

# Instantiate the class

authentication = linkedin.LinkedInDeveloperAuthentication(CONSUMER_KEY, CONSUMER_SECRET, USER_TOKEN, USER_SECRET, RETURN_URL, linkedin.PERMISSIONS.enums.values())

# Pass it in to the app...

application = linkedin.LinkedInApplication(authentication)

# Use the app....

application.get_profile()

I don't think it would be very difficult to expand the use of requests_oauthlib to impelment a full blown OAuth 1.0a flow for general purpose use. I'd be glad to pitch in if you're interested, but you know your code much better than I do and could probably do it quicker without me.