web抓包结果对应python|web抓包结果对应python request
一、抓包内容
通过F12获取web网页中query-queue-rate的内容:
文章图片
web抓取的包.png 二、分析
该包中包含:
General:通用信息
Response Headers:返回包头
Request Headers:请求包头
-Cookie:加密
-Host:对应的host
Form Data:请求的Data信息
三、python的request该如何填写
DATA = https://www.it610.com/article/{'exact_key': '091198',
'sys_key': 'ipo',
'biz_key': 'ipo_stock'}
Cookie = 'uid=100001;
locale=zh-cn;
cipher_device_id=1600167818814682;
device_id=1600167818814682;
sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%22174917ebf429fd-09a06f098fff8e-3323767-2073600-174917ebf43114%22%2C%22first_id%22%3A%22%22%2C%22props%22%3A%7B%7D%2C%22%24device_id%22%3A%22174917ebf429fd-09a06f098fff8e-3323767-2073600-174917ebf43114%22%7D;
web_sig=j%2FTZLVEClzkZoTylihiTTtjc2hqUJPLXLMvSZi4K3swNA2EqErrY4DX3H78lQ20q9F2EbzyETaRl994NVuZwFt37eAfDpciiVAtaSVDg6ptGmw0F1ak%2F6uFUm%2BYEK%2FLk'
host = 'https://queue.futuhk.com/queue/query-queue-rate'
r = requests.post(host, data=https://www.it610.com/article/DATA, headers={'Host': 'queue.futuhk.com', 'Cookie': Cookie}, verify=False)
四、注意事项
-
- Cookie、host需要以字典的形式写入到header里面
-
- 不能将cookies作为字典形式,传入到request中
#错误写法
Cookie ={ 'Cookie': 'uid=100001;
locale=zh-cn;
cipher_device_id=1600167818814682;
device_id=1600167818814682;
sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%22174917ebf429fd-09a06f098fff8e-3323767-2073600-174917ebf43114%22%2C%22first_id%22%3A%22%22%2C%22props%22%3A%7B%7D%2C%22%24device_id%22%3A%22174917ebf429fd-09a06f098fff8e-3323767-2073600-174917ebf43114%22%7D;
web_sig=j%2FTZLVEClzkZoTylihiTTtjc2hqUJPLXLMvSZi4K3swNA2EqErrY4DX3H78lQ20q9F2EbzyETaRl994NVuZwFt37eAfDpciiVAtaSVDg6ptGmw0F1ak%2F6uFUm%2BYEK%2FLk'}
requests.post(host, data=https://www.it610.com/article/DATA, cookies=Cookie, headers={'Host': 'queue.futuhk.com'}, verify=False)
此时服务器那边因为字段对应不上,uid会解析错误
-
- 不能将cookies以字符产形式,传入到request中
#错误写法
Cookie ='uid=100001;
locale=zh-cn;
cipher_device_id=1600167818814682;
device_id=1600167818814682;
sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%22174917ebf429fd-09a06f098fff8e-3323767-2073600-174917ebf43114%22%2C%22first_id%22%3A%22%22%2C%22props%22%3A%7B%7D%2C%22%24device_id%22%3A%22174917ebf429fd-09a06f098fff8e-3323767-2073600-174917ebf43114%22%7D;
web_sig=j%2FTZLVEClzkZoTylihiTTtjc2hqUJPLXLMvSZi4K3swNA2EqErrY4DX3H78lQ20q9F2EbzyETaRl994NVuZwFt37eAfDpciiVAtaSVDg6ptGmw0F1ak%2F6uFUm%2BYEK%2FLk'
requests.post(host, data=https://www.it610.com/article/DATA, cookies=Cookie, headers={'Host': 'queue.futuhk.com'}, verify=False)
【web抓包结果对应python|web抓包结果对应python request】此时接口会应为传入参数类型错误,报异常
推荐阅读
- 私有化轻量级持续集成部署方案--03-部署web服务(下)
- web网页模板|如此优秀的JS轮播图,写完老师都沉默了
- spring|spring boot项目启动websocket
- OC:|OC: WKWebView详解
- WKWebview|WKWebview js 调用oc 和oc调用js
- javaweb|基于Servlet+jsp+mysql开发javaWeb学生成绩管理系统
- webug3.0渗透基础第九、十关笔记
- 前端|web前端dya07--ES6高级语法的转化&render&vue与webpack&export
- WebSocket|WebSocket 语法解析
- 踌躇满志想创业,结果到头来两手空空