-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added some documentation, mentioned my changes
- Loading branch information
Showing
1 changed file
with
36 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,39 +1,38 @@ | |||
Standard stuff applies to install. Run this from | This is a fork of abrenzel's python wrapper for the linkedin api: https://github.com/mrgaaron/LinkedIn-Client-Library/ | ||
the command line: |
|
||
His is very nice, but the search stuff is broken. Search should work here. It's a bit hacky. | |||
See the docs here: | |||
http://developer.linkedin.com/docs/DOC-1191# | |||
|
|||
Dependencies: | |||
lxml | |||
httplib2 (for OAuth) | |||
|
|||
Installable via: | |||
|
|
||
python setup.py install | python setup.py install | ||
|
|
||
Documentation is in the doc directory. Any questions | To get started: | ||
can be forwarded to abrenzel@millerresource.com. I'm |
|
||
usually pretty good about responding. | 1. First, of course, we need to instantiate the API object with our consumer key and secret: | ||
|
|
||
The LinkedIn client library has lxml as a dependency for | consumer_key = 'mykey' | ||
XML processing. Yes, I know Python has a standard XML | consumer_secret = 'mysecret' | ||
parser implementation. Yes, I know lxml can be a bear to install | APIClient = LinkedInAPI(consumer_key, consumer_secret) | ||
if you're building from source. Still, there's no faster or |
|
||
more full-featured XML parsing tool available for Python. I | 2. The first step for a new user is to retrieve a request token. This is done like so: | ||
have no plans to include support for the etree parser in the |
|
||
standard libary. | request_token = APIClient.get_request_token() | ||
|
|
||
One other dependency is httplib2 (for the OAuth module). You | 3. Then, we generate the URL to send the user to for authentication (I know the first line is a little ugly, I will probably simplify this soon): | ||
can obtain this module from the Python Package Index. |
|
||
|
authorization_url = APIClient.base_url + APIClient.authorize_path | ||
This package is intended for use with the LinkedIn API. | url = "%s?oauth_token=%s" % (authorization_url, request_token['oauth_token']) | ||
You must supply your own API key for this library to work. |
|
||
Once you have an API key from LinkedIn, the syntax for instantiating | 4. Once the user has authenticated, you will need to collect the oauth_verifier returned by the LinkedIn server in the URL. This can be done | ||
an API client object is this: | either by having the user type it in themselves or collecting the URL argument on the redirect from LinkedIn. However you decided to get it, | ||
|
this is how you use it: | ||
mykey = 'mysecretkey' |
|
||
mysecret = 'mysecretsecret' | access_token = APIClient.get_access_token(request_token, oauth_verifier) | ||
myclient = LinkedInAPI(mykey, mysecret) |
|
||
|
That's it! You can use this access token for every request this particular user makes, for as long as they have authorized you to use it. | ||
From there, you can obtain request tokens, authorization urls, | |||
access tokens, and actual LinkedIn data through the LinkedInAPI | |||
object's methods. The object will handle signing requests, url | |||
formatting, and XML parsing for you. Full documentation for these | |||
methods can be found in the doc directory (or will be there when | |||
I get it done). | |||
|
|||
Happy apping! | |||
|
|||
Aaron |