Python - httplib实例
来源:互联网 发布:逆光源网络剧在线观看 编辑:程序博客网 时间:2024/06/01 09:10
python的http库非常简单易用,用于快速调试C/S协议 :)
详见:http://docs.python.org/release/2.6/library/httplib.html
# coding=gbkimport httplibprint 'Start ...'conn = httplib.HTTPConnection('www.google.com',80)conn.set_debuglevel(2)#HTTPConnection.request ( method , url [ , body [ , headers ]] )conn.request('GET','/',headers = {"Host": "www.google.com", "User-Agent": "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1) Gecko/20090624 Firefox/3.5", "Accept": "text/plain"})#conn.getresponse().read()respond = conn.getresponse()#获取所有的响应头信息。print 'status:', respond.status#获取服务器所使用的http协议版本。11表示http/1.1;10表示http/1.0。print 'version:', respond.version#获取响应的状态码。如:200表示请求成功。print 'reason:', respond.reason#以列表的形式返回所有的头信息。print 'msg:', respond.msg#以列表的形式返回所有的头信息。http_respond = respond.getheaders()for it in http_respond: print itconn.close()print 'End ...'
- Python - httplib实例
- python urllib2和httplib请求的速度比较实例测试
- PYTHON HTTPLIB TIMEOUT
- python--httplib模块使用
- python urllib2 httplib HTTPConnection
- python--httplib模块使用
- python--httplib模块使用
- python httplib库简介。。。
- python--httplib模块使用
- python的httplib注意事项
- python--httplib模块使用
- python--httplib模块使用
- Python httplib模块
- python httplib get
- python httplib长连接
- python--httplib模块使用
- python HTTPlib &&find,seek
- python--httplib模块使用
- tianlesoftware blog
- 使用JAVA数字证书做数字签名认证
- 利用fileupload 实现上传功能
- 从查询结果中生成xml
- vs2008 出现了“找不到MSVCR90D.dll,因此这个程序没能启动"处理办法
- Python - httplib实例
- 网站搜索优化SEO概念与方法
- 搜索相关术语
- 【读书笔记】AgilePPP——敏捷宣言及12条原则
- 深入浅出---unix多进程编程之wait()和waitpid()函数
- PHPUnit入门篇
- Eclipse需要学的快捷键
- 单位Peta 拍它(千万亿)--今日才知的数量级
- 遗传算法入门例子和总结