Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding support for a redirect url

  • Loading branch information...
commit 919021d1bbf35f613f67d310e6bed8b53a7624e9 1 parent c502261
@gpambrozio gpambrozio authored
Showing with 8 additions and 3 deletions.
  1. +8 −3 liclient/__init__.py
View
11 liclient/__init__.py
@@ -34,7 +34,7 @@ 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
@@ -42,8 +42,13 @@ def get_request_token(self):
"""
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
Please sign in to comment.
Something went wrong with that request. Please try again.