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

后端 未结 4 1438
梦毁少年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:33

    I met the problem as well and now it pass

    import json
    import urllib.request as ur
    import urllib.parse as par
    
    html = ur.urlopen(url).read()
    print(type(html))
    data = json.loads(html.decode('utf-8'))
    

提交回复
热议问题