http://stackoverflow.com/questions/24069197/httpresponse-object-json-object-must-be-str-not-bytes
HTTPResponse object — JSON object must be str, not ‘bytes‘
up vote17down votefavorite 7 |
I‘ve been trying to update a small Python library called libpynexmo to work with Python 3. I‘ve been stuck on this function:
When it gets to this, json responds with:
I read in a few places that for I‘m at a loss as to where to go with this next, but being that my entire 1500 line script is freshly converted to Python 3, I don‘t feel like going back to 2.7. json python-3.x python-3.4 nexmo
|
||||||||||||||||||||
|
4 Answers
up vote13down voteaccepted |
I recently wrote a small function to send Nexmo messages. Unless you need the full functionality of the libpynexmo code, this should do the job for you. And if you want to continue overhauling libpynexmo, just copy this code. The key is utf8 encoding. If you want to send any other fields with your message, the full documentation for what you can include with a nexmo outbound message is here Python 3.4 tested Nexmo outbound (JSON):
|
|||
add a comment |
up vote30down vote |
Facing the same problem I solve it using decode()
|
||||
|
up vote5down vote |
I met the problem as well and now it pass
|
HTTPResponse object — JSON object must be str, not 'bytes'