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