- #!/usr/bin/env python
- # encoding=utf-8
- import urllib2, httplib
- import StringIO, gzip
- #解压gzip
- def gzdecode(data) :
- compressedstream = StringIO.StringIO(data)
- gziper = gzip.GzipFile(fileobj=compressedstream)
- data2 = gziper.read() # 读取解压缩后数据
- return data2
python http请求时gzip解压
最新推荐文章于 2024-04-26 15:13:37 发布