From 73b13f6e4b2a702e9ab0c0cd2c968f40f500bb77 Mon Sep 17 00:00:00 2001 From: rendiya Date: Fri, 20 Oct 2017 09:50:03 +0700 Subject: [PATCH] update __init__.py fix bug File "/home/rendiya/Public/pypro/cucakrowo/facebook/venv/lib/python3.5/site-packages/oauth2/__init__.py", line 493, in sign_request self['oauth_body_hash'] = base64.b64encode(sha1(str(self.body).decode('utf-8')).digest()) AttributeError: 'str' object has no attribute 'decode' --- oauth2/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oauth2/__init__.py b/oauth2/__init__.py index a1776a75..64ba83c1 100644 --- a/oauth2/__init__.py +++ b/oauth2/__init__.py @@ -490,7 +490,7 @@ def sign_request(self, signature_method, consumer, token): # section 4.1.1 "OAuth Consumers MUST NOT include an # oauth_body_hash parameter on requests with form-encoded # request bodies." - self['oauth_body_hash'] = base64.b64encode(sha1(self.body).digest()) + self['oauth_body_hash'] = base64.b64encode(sha1(str(self.body).encode('utf-8')).digest()) if 'oauth_consumer_key' not in self: self['oauth_consumer_key'] = consumer.key