Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Fix json decoding on Python 3 #71

Merged
merged 2 commits into from
Oct 30, 2014
Merged

Fix json decoding on Python 3 #71

merged 2 commits into from
Oct 30, 2014

Conversation

jonashaag
Copy link
Contributor

Related to #36 -- there exists a much easier solution to the approach taken there, that is just relying on the requests library to decode the json (the Python 2/3 difference is dealt with there already).

How can the current implementation even pass the tests on Python 3? The get_database_list CAN'T possibly work on Python 3 because it wasn't taken care of in #36.

@aviau
Copy link
Collaborator

aviau commented Oct 29, 2014

Is it me or Travis didn't run? Ill merge if Travis passes.
Ill try to merge it in another branch to trigger a build.

@aviau
Copy link
Collaborator

aviau commented Oct 29, 2014

Looks like the build started after I pushed to the branch lol.
Only 8 hours late!

@aviau
Copy link
Collaborator

aviau commented Oct 29, 2014

@jonashaag It failed in python3 :(

# must decode in python 3
res = json.loads(response.content.decode('utf8'))

return res
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function used to return a dict ant it now returns a string (json)
You should return json.loads(response.json())

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HTTP body content is expected to be bytes, not unicode.
aviau added a commit that referenced this pull request Oct 30, 2014
Fix json decoding on Python 3 (thanks @jonashaag)
@aviau aviau merged commit 991ef5b into influxdata:master Oct 30, 2014
@aviau
Copy link
Collaborator

aviau commented Oct 30, 2014

@jonashaag thanks!

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

Successfully merging this pull request may close these issues.

2 participants