Python mechanize gzip response handling
来源:互联网 发布:好听的编程项目名称 编辑:程序博客网 时间:2024/05/18 03:09
http://unformatt.com/news/python-mechanize-gzip-response-handling/
Mechanize is awesome. The documentation is shit. The gzip support is non-existent. Some sites like Yahoo! require gzip support.
def ungzipResponse(r,b):headers = r.info()if headers['Content-Encoding']=='gzip':import gzipgz = gzip.GzipFile(fileobj=r, mode='rb')html = gz.read()gz.close()headers["Content-type"] = "text/html; charset=utf-8"r.set_data( html )b.set_response(r)b = Browser()b.addheaders.append( ['Accept-Encoding','gzip'] )r = b.open('http://some-gzipped-site.com')ungzipResponse(r,b)print r.read()
- Python mechanize gzip response handling
- python使用mechanize
- python 之mechanize
- Python mechanize模块
- Python Mechanize Cheat Sheet
- Python mechanize 的一点说明
- Python使用mechanize模拟浏览器
- Python:mechanize模拟浏览器行为
- Python:mechanize模拟浏览器行为
- mechanize
- GZIP Http Servlet Response
- GZIP:response压缩
- Ajax File Upload Response Handling
- Python中mechanize库的简单使用说明
- python模块学习---mechanize(模拟浏览器)
- python 使用 mechanize 模拟浏览器访问网页
- python 使用mechanize进行web网页交互
- python使用mechanize与网页交互
- zz 人脸识别发展史与算法综述
- 多事之秋
- Silverlight/Windows8/WPF/WP7/HTML5周学习导读(8月5日-8月12日)
- 如何在Django中接收JSON格式的数据
- python利用gzip压缩解压缩StringIO
- Python mechanize gzip response handling
- 高新技术之代理
- [转自豆瓣~]C,C++,C#三者区别
- opencv下调用K均值函数cvKMeans2聚类图像例程
- poj 1066 计算几何构图+最短路
- Oracle RBA 浅谈
- Swing中JInternalFrame窗口平铺、级联等实现
- mac体验具体步骤详解
- JavaBean表单验证