【问题标题】:Python requests post error.. can't decodingPython请求发布错误..无法解码
【发布时间】:2020-06-01 10:14:07
【问题描述】:
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】:

您需要安装 brotli 包才能使用“内容编码”:“br”。是unable to decode Python web request的复制品

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2022-08-13
  • 1970-01-01
  • 2018-09-10
  • 1970-01-01
  • 2020-08-09
  • 2022-07-11
  • 2019-10-27
  • 1970-01-01
相关资源
最近更新 更多