-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
json.loads error with Python 3.4 in gcloud.storage.connection.Connection.api_request #697
Conversation
…nnection.api_request is decoded to a string before being passed to json.loads
The tests that have failed because they mock the response and assume a Of course, I could update the PR to change the assumption in the tests, but somehow that feels like the wrong approach? |
Please do update the tests to make the mocked payloads bytes. |
Darn. I didn't realise github would keep updating the PR - I am having to run the test suite with Travis (on my fork) as I couldn't get Tox to run locally. |
Going to kill this PR and come back when I have something that works. |
@craigloftus I'm happy to help get |
@dhermes Thanks. I have travis building against my fork, which has let me get somewhere. After a couple of attempts I changed the mocked This travis build of my fork shows the remaining issue, which is actually the root cause of Issue #653; that the exception handling code is expecting |
@craigloftus Can you send error output from your issues running As for the remaining errors, it looks like you aren't JSON parsing the errors. It can be addressed by changing one line if isinstance(content, str): to if isinstance(content, six.string_types): UPDATE: I just realized |
@dhermes My issue is mainly that I have no idea how to use
Yeah. I think I now have a commit (craigloftus@e7ffadc7) which is passing on all python versions. It will probably be tomorrow before I get a chance to figure out how to rebase and squash my changes into a neat PR. |
@craigloftus You can use tox just by running Googling for your [sudo] pip install --upgrade tox virtualenv (The |
When using Python 3
httplib2
returns request content asbytes
butjson.loads
requiresstr
.It might be desirable to examine the content-type header returned by
httplib2
to decided which encoding to use, although it is likely to always beutf-8
?