Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: must be string or buffer, not None #7

Open
espeed opened this issue Jun 11, 2011 · 1 comment
Open

TypeError: must be string or buffer, not None #7

espeed opened this issue Jun 11, 2011 · 1 comment

Comments

@espeed
Copy link

espeed commented Jun 11, 2011

Traceback (most recent call last):
File "/env/lib/python2.7/site-packages/flask/app.py", line 889, in call
return self.wsgi_app(environ, start_response)
File "
/env/lib/python2.7/site-packages/flask/app.py", line 879, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/env/lib/python2.7/site-packages/flask/app.py", line 876, in wsgi_app
rv = self.dispatch_request()
File "
/env/lib/python2.7/site-packages/flask/app.py", line 695, in dispatch_request
return self.view_functionsrule.endpoint
File "/blog/views.py", line 94, in index
resp = twitter.get('statuses/home_timeline.json')
File "
/env/lib/python2.7/site-packages/flaskext/oauth.py", line 173, in get
return self.request(_args, *_kwargs)
File "/env/lib/python2.7/site-packages/flaskext/oauth.py", line 239, in request
body=data, headers=headers))
File "
/env/lib/python2.7/site-packages/oauth2/init.py", line 662, in request
req.sign_request(self.method, self.consumer, self.token)
File "~/env/lib/python2.7/site-packages/oauth2/init.py", line 493, in sign_request
self['oauth_body_hash'] = base64.b64encode(sha(self.body).digest())
TypeError: must be string or buffer, not None

Evidently, self.body can't be None but is always being set to None for GET requests.

Here is the problem line in oauth2/init.py...

if not self.is_form_encoded:
488 # according to
489 # http://oauth.googlecode.com/svn/spec/ext/body_hash/1.0/oauth-bodyhash.html
490 # section 4.1.1 "OAuth Consumers MUST NOT include an
491 # oauth_body_hash parameter on requests with form-encoded
492 # request bodies."
493 self['oauth_body_hash'] = base64.b64encode(sha(self.body).digest())

Here's a patch: https://gist.github.com/1020196

@ghost
Copy link

ghost commented Aug 8, 2011

I also had this issue this patch fix it, thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant