`unicode` is not defined in python 3
ottonemo opened this issue · comments
In utils.py
there is still one line that uses unicode()
which will fail in python3. Patch:
@@ -17,7 +17,10 @@ def validate_hub_signature(app_secret, r
pass
else:
digest_module = getattr(hashlib, hash_method)
- hmac_object = hmac.new(str(app_secret), unicode(request_payload), digest_module)
+ if six.PY2:
+ hmac_object = hmac.new(str(app_secret), unicode(request_payload), digest_module)
+ else:
+ hmac_object = hmac.new(bytearray(app_secret, 'utf8'), request_payload, digest_module)
generated_hash = hmac_object.hexdigest()
if hub_signature == generated_hash:
return True