Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions liclient/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,21 @@ def __init__(self, ck, cs):
'JGRP', 'PICT', 'RECU', 'PRFU',
'QSTN', 'STAT']

def get_request_token(self):
def get_request_token(self, redirect_url=None):
"""
Get a request token based on the consumer key and secret to supply the
user with the authorization URL they can use to give the application
access to their LinkedIn accounts
"""
client = oauth.Client(self.consumer)
request_token_url = self.base_url + self.request_token_path

resp, content = client.request(request_token_url, 'POST')

if redirect_url:
resp, content = client.request(request_token_url, 'POST',
body="oauth_callback=%s" % urllib.quote_plus(redirect_url),
headers={'Content-Type': 'application/x-www-form-urlencoded'})
else:
resp, content = client.request(request_token_url, 'POST')
request_token = dict(urlparse.parse_qsl(content))
return request_token

Expand Down