Commit 5a22bf73 authored by Derek Arnold's avatar Derek Arnold
Browse files

Add unicode type detection for consumer key/secret

The hmac module won't accept unicode objects so cast them before using
them if they're present.
parent 517a0f25
......@@ -28,6 +28,12 @@ class OAuthHandler(AuthHandler):
OAUTH_ROOT = '/oauth/'
def __init__(self, consumer_key, consumer_secret, callback=None, secure=False):
if type(consumer_key) == unicode:
consumer_key = bytes(consumer_key)
if type(consumer_secret) == unicode:
consumer_secret = bytes(consumer_secret)
self._consumer = oauth.OAuthConsumer(consumer_key, consumer_secret)
self._sigmethod = oauth.OAuthSignatureMethod_HMAC_SHA1()
self.request_token = None
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