Python请求发布错误。无法解码

问题描述 投票:0回答:1
api_url = "https://en.coinjinja.com/api/events/search"
headers = {'origin': 'https://en.coinjinja.com',
        'accept-encoding': 'gzip, deflate, br',
        'accept-language': 'ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7',
        'authority': 'en.coinjinja.com',
        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.106 Safari/537.36',
        'content-type': 'application/json',
        'content-length': '126',
        'accept': '*/*',
        'referer': 'https://en.coinjinja.com/events/time/next_week/tags/hardfork+airdrop+burn+exchange+partnership'
    }
    data = {"start": "2020-02-17","end":"2020-02-24","symbol":"","types":["hardfork","airdrop","burn","exchange","partnership"]}
    api_request = requests.post(api_url, headers=headers, data=json.dumps(data))
    print(api_request.headers)
    print(api_request.encoding)
    print(api_request.content.decode('utf-8','ignore'))
python post python-requests decode encode
1个回答
0
投票

您需要安装brotli软件包才能与“ Content-Encoding”:“ br”一起使用。与unable to decode Python web request

重复
© www.soinside.com 2019 - 2024. All rights reserved.