HTTPResponse object — JSON object must be str, not 'bytes'
http://stackoverflow.com/questions/24069197/httpresponse-object-json-object-must-be-str-not-bytes
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. |
|||||||||||||||||||||
|
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):
|
||||
Facing the same problem I solve it using decode()
|
|||||
|