python发送请求两种代理设置方式
2015-07-28 14:07
706 查看
1使用httplib时的设置方式
2使用urllib2时的设置方式
这样就可以在burp中观察不同请求变化
import httplib,urllib,urllib2; params = urllib.urlencode({ 'param':"55B2A1EDA8B09D13", 'js_sfl':2, 'codetxt':'532832'}); headers = { "Host": "www.aokang.cn", "Content-Length": "81", "Content-Type": "application/x-www-form-urlencoded"}; conn = httplib.HTTPConnection("localhost",8555);#在此步骤设置代理地址 conn.request(method="POST",url="http://www.aokang.cn/member/verify_repassword.aspx?action=edit HTTP/1.1",body=params,headers=headers); response = conn.getresponse(); conn.close();
2使用urllib2时的设置方式
import httplib,urllib,urllib2; params = urllib.urlencode({ 'param':"55B2A1EDA8B09D13", 'js_sfl':2, 'codetxt':'532832'}); headers = { "Host": "www.aokang.cn", "Content-Length": "81", "Content-Type": "application/x-www-form-urlencoded"}; opener = urllib2.build_opener( urllib2.ProxyHandler({'http':"localhost:8555"}) )#在这一步设置代理地址和端口 urllib2.install_opener(opener) sContent = urllib2.urlopen("http://www.aokang.cn/member/verify_repassword.aspx?action=edit HTTP/1.1") req = urllib2.Request(url = "http://www.aokang.cn/member/verify_repassword.aspx?action=edit HTTP/1.1",data=params)
这样就可以在burp中观察不同请求变化
相关文章推荐
- Python动态类型的学习---引用的理解
- Python3写爬虫(四)多线程实现数据爬取
- 垃圾邮件过滤器 python简单实现
- 下载并遍历 names.txt 文件,输出长度最长的回文人名。
- install and upgrade scrapy
- Scrapy的架构介绍
- Centos6 编译安装Python
- 使用Python生成Excel格式的图片
- 让Python文件也可以当bat文件运行
- [Python]推算数独
- Python中zip()函数用法举例
- Python中map()函数浅析
- Python在CAM软件Genesis2000中的应用
- 使用Shiboken为C++和Qt库创建Python绑定
- FREEBASIC 编译可被python调用的dll函数示例
- Python 七步捉虫法
- Python实现的基于ADB的Android远程工具