好吧,因为要改个采集脚本,所以学习了一下Python中如何post gzip压缩数据。

import zlib
import urllib2
req = urllib2.Request(url,zlib.compress(你要post的数据));
req.add_header('Accept-Encoding', "gzip");
response = urllib2.urlopen(req);
content = response.read();

Related Posts: Python2-Post请求gzip数据 :