Skip to content
New issue

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

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

Already on GitHub? # to your account

fix for post data type error in py3. #65

Closed
wants to merge 1 commit into from
Closed

Conversation

lxyu
Copy link

@lxyu lxyu commented Dec 20, 2013

Env:
python 3.3.3

Reproduce:

$ python google.py

TypeError raised for /#/authorized

Traceback (most recent call last):
  File "/Users/lxyu/.dotfiles/.virtualenvs/py3/lib/python3.3/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/Users/lxyu/.dotfiles/.virtualenvs/py3/lib/python3.3/site-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/Users/lxyu/.dotfiles/.virtualenvs/py3/lib/python3.3/site-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/lxyu/.dotfiles/.virtualenvs/py3/lib/python3.3/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/Users/lxyu/.dotfiles/.virtualenvs/py3/lib/python3.3/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/lxyu/.dotfiles/.virtualenvs/py3/lib/python3.3/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/lxyu/.dotfiles/.virtualenvs/py3/lib/python3.3/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/lxyu/.dotfiles/.virtualenvs/py3/lib/python3.3/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/Users/lxyu/.dotfiles/.virtualenvs/py3/lib/python3.3/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/lxyu/.dotfiles/.virtualenvs/py3/lib/python3.3/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/lxyu/Workspace/lxyu/flask-oauthlib/flask_oauthlib/client.py", line 616, in decorated
    data = self.handle_oauth2_response()
  File "/Users/lxyu/Workspace/lxyu/flask-oauthlib/flask_oauthlib/client.py", line 578, in handle_oauth2_response
    method=self.access_token_method,
  File "/Users/lxyu/Workspace/lxyu/flask-oauthlib/flask_oauthlib/client.py", line 347, in http_request
    resp = http.urlopen(req)
  File "/usr/local/Cellar/python3/3.3.3/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 156, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/Cellar/python3/3.3.3/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 467, in open
    req = meth(req)
  File "/usr/local/Cellar/python3/3.3.3/Frameworks/Python.framework/Versions/3.3/lib/python3.3/urllib/request.py", line 1179, in do_request_
    raise TypeError(msg)
TypeError: POST data should be bytes or an iterable of bytes. It cannot be of type str.

@lepture
Copy link
Owner

lepture commented Dec 20, 2013

I think you are doing it in the wrong way. But I know what's in your mind, I will figure out a more common solution.

lepture added a commit that referenced this pull request Dec 20, 2013
@lxyu
Copy link
Author

lxyu commented Dec 20, 2013

works now.

@lxyu lxyu closed this Dec 20, 2013
@lxyu
Copy link
Author

lxyu commented Jan 3, 2014

would you please upload the updated version to pypi?

current pypi version is broken with py3 for me (strange it didn't happen to others?), and I have to manully install the github version everytime.

Thanks.

@lepture
Copy link
Owner

lepture commented Jan 3, 2014

@lxyu released 0.4.2, sorry for the delay.

strange it didn't happen to others?

coz not many people use py3 now.

@lxyu
Copy link
Author

lxyu commented Jan 3, 2014

soo fast, thank you very much!

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

Successfully merging this pull request may close these issues.

2 participants