HTTPResponse object — JSON object must be str, not 'bytes'

后端 未结 4 1449
梦毁少年i
梦毁少年i 2020-12-02 20:51

I\'ve been trying to update a small Python library called libpynexmo to work with Python 3.

I\'ve been stuck on this function:

def send_request_json(         


        
4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-02 21:14

    Facing the same problem I solve it using decode()

    ...
    rawreply = connection.getresponse().read()
    reply = json.loads(rawreply.decode())
    

提交回复
热议问题