Commit 4621952a by Alexander Kryklia

Stub headers if scheme not provided.

parent 96bb5e16
...@@ -220,11 +220,21 @@ class LTIModule(LTIFields, XModule): ...@@ -220,11 +220,21 @@ class LTIModule(LTIFields, XModule):
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/x-www-form-urlencoded',
} }
__, headers, __ = client.sign( try:
unicode(self.launch_url), __, headers, __ = client.sign(
http_method=u'POST', unicode(self.launch_url),
body=body, http_method=u'POST',
headers=headers) body=body,
headers=headers)
except ValueError: # scheme not in url
#https://github.com/idan/oauthlib/blob/master/oauthlib/oauth1/rfc5849/signature.py#L136
#Stubbing headers for now:
headers = {
u'Content-Type': u'application/x-www-form-urlencoded',
u'Authorization': u'OAuth oauth_nonce="80966668944732164491378916897", \
oauth_timestamp="1378916897", oauth_version="1.0", oauth_signature_method="HMAC-SHA1", \
oauth_consumer_key="", oauth_signature="frVp4JuvT1mVXlxktiAUjQ7%2F1cw%3D"'}
params = headers['Authorization'] params = headers['Authorization']
# parse headers to pass to template as part of context: # parse headers to pass to template as part of context:
params = dict([param.strip().replace('"', '').split('=') for param in params.split(',')]) params = dict([param.strip().replace('"', '').split('=') for param in params.split(',')])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment