Skip to content

Commit dd34c70

Browse files
author
Jeff Hammel
committed
follow up to fix for how hmac works in 2.4
1 parent 5700371 commit dd34c70

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

oauth2/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@
4040

4141
try:
4242
from hashlib import sha1
43-
sha = sha1
43+
sha_new = sha = sha1
4444
except ImportError:
4545
# hashlib was added in Python 2.5
46+
import sha as sha_new
4647
from sha import sha
4748

4849
import _version
@@ -828,7 +829,7 @@ def sign(self, request, consumer, token):
828829
"""Builds the base signature string."""
829830
key, raw = self.signing_base(request, consumer, token)
830831

831-
hashed = hmac.new(key, raw, sha)
832+
hashed = hmac.new(key, raw, sha_new)
832833

833834
# Calculate the digest base 64.
834835
return binascii.b2a_base64(hashed.digest())[:-1]

0 commit comments

Comments
 (0)