python 中的 gzip url 请求
gzip url request in python
我将 python 与请求模块一起使用,以通过 json 提要从 api 获取数据。
当我将 gzip 请求作为编码包含在内时,我没有看到任何变化。我在这里实施的方式不对吗?
my_headers = {'accept-encoding':'gzip'}
response = requests.get(url, headers=my_headers)
print(response.headers)
print(len(response.content))
响应 headers 总是返回
'Content-Encoding': 'gzip'
但是无论是否包含我的请求都会发生这种情况headers,长度和加载时间也不会改变
Requests: HTTP for Humans - Binary Response Content
gzip and deflate transfer-encodings are automatically decoded for you.
我将 python 与请求模块一起使用,以通过 json 提要从 api 获取数据。 当我将 gzip 请求作为编码包含在内时,我没有看到任何变化。我在这里实施的方式不对吗?
my_headers = {'accept-encoding':'gzip'}
response = requests.get(url, headers=my_headers)
print(response.headers)
print(len(response.content))
响应 headers 总是返回
'Content-Encoding': 'gzip'
但是无论是否包含我的请求都会发生这种情况headers,长度和加载时间也不会改变
Requests: HTTP for Humans - Binary Response Content
gzip and deflate transfer-encodings are automatically decoded for you.