【发布时间】:2019-07-29 21:25:47
【问题描述】:
我有一个启用了 brotli 压缩的 Apache 服务器。 当我从我的 cli 发送 curl 请求时,它工作正常。但是,当我从 python 发送请求时,它会返回没有 brotli 压缩的纯文本。这意味着它没有使用 brotli 压缩。
有效的卷曲命令:
curl -H "Accept-Encoding: br" http://testsite/index.html
这是python代码:
headers = {
' Accept-Encoding': 'br',
}
response = requests.get('http://testsite/index.html', headers=headers)
如何从 python 发出请求,以便它向服务器发出请求以使用 brotli 压缩。
【问题讨论】:
-
是不是因为Accept-Encoding前面有空格?
-
不,空间没有任何区别。
标签: python python-2.7 brotli