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

Internal Server Error: object supporting the buffer API required #203

Closed
speedingdeer opened this issue Jan 11, 2016 · 9 comments
Closed
Labels

Comments

@speedingdeer
Copy link

Hi, I'm on python 3.4.0 and python-oauth2 1.9. The doc says it supports python up to 3.4 but it doesn't work for me.

Traceback (most recent call last):
File "/Users/speedingdeer/code/.../pyvenv3.4/lib/python3.4/site-packages/bottle.py", line 862, in _handle
return route.call(*_args)
File "/Users/speedingdeer/code/.../pyvenv3.4/lib/python3.4/site-packages/bottle.py", line 1732, in wrapper
rv = callback(_a, **ka)
File "server.py", line 242, in do_oauth_callback
resp, content = client.request(request_url, 'GET')
File "/Users/speedingdeer/code/.../pyvenv3.4/lib/python3.4/site-packages/oauth2/init.py", line 687, in request
connection_type=connection_type)
File "/Users/speedingdeer/code.../pyvenv3.4/lib/python3.4/site-packages/httplib2/init.py", line 1314, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "/Users/speedingdeer/code/.../pyvenv3.4/lib/python3.4/site-packages/httplib2/init.py", line 1116, in _request
headers=headers, redirections=redirections - 1)
File "/Users/speedingdeer/code/.../pyvenv3.4/lib/python3.4/site-packages/oauth2/init.py", line 673, in request
req.sign_request(self.method, self.consumer, self.token)
File "/Users/speedingdeer/code/.../pyvenv3.4/lib/python3.4/site-packages/oauth2/init.py", line 493, in sign_request
self['oauth_body_hash'] = base64.b64encode(sha1(self.body).digest())
TypeError: object supporting the buffer API required

Do you know something about this issue?

@jaitaiwan
Copy link
Contributor

Taking a look, it means that self.body isn't an object that has a buffer api... What are you passing in as the body?

@speedingdeer
Copy link
Author

I've been fallowing this code:
http://blog.jaarce.com/2012/07/facebook-and-twitter-authentication.html
so you can simply copy paste it. on 2.7 it works just fine, on 3.4 3.5 it doesn't.

@jaitaiwan
Copy link
Contributor

Python-oauth2 is backwards compatible with 2.7, but I'd say there's some
differences in the code you linked to that are not compatible. Can you
reduce the code to replicate the issue into the smallest possible form?

On Wed, 13 Jan 2016 at 12:16 Filip Wiśniewski [email protected]
wrote:

I've been fallowing this code:
http://blog.jaarce.com/2012/07/facebook-and-twitter-authentication.html
so you can simply copy paste it. on 2.7 it works just fine, on 3.4 3.5 it
doesn't.


Reply to this email directly or view it on GitHub
#203 (comment)
.

@speedingdeer
Copy link
Author

Yes I can, I won't do it now cause it's late night in my timezone, but I will put you here the snippet tomorrow.

@jaitaiwan
Copy link
Contributor

Hey @speedingdeer how'd you go?

@rickhanlonii
Copy link
Collaborator

Bump @speedingdeer

@njohnsn
Copy link

njohnsn commented Jul 14, 2016

Here is the code I'm trying to use from the wiki:

#!/local/web/.local/bin/python3.5

import oauth2 as oauth

# Create your consumer with the proper key/secret
consumer = oauth.Consumer(key="<KEY>",
    secret="<SECRET>")


# Request Token URL for ClearPass
request_token_url = "<URL>"

# Create our client
client = oauth.Client(consumer)

# The OAuth Client request works just like httplib2 for the most part
(resp, content) = client.request(request_token_url,"GET")
print(resp)
print(content)

@njohnsn
Copy link

njohnsn commented Jul 14, 2016

Nevermind, I was using a GET when I needed to POST.

Thanks.
-Neil

@ivishnevs
Copy link

may be this PR can fix this issue )

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

No branches or pull requests

5 participants