下个报告,手动下载需要一个个填写提交,文件自动下载,这样操作对于多个对象都要提交一次表单非常麻烦,有没有什么办法模拟表单进行自动提交下载
general内容:
Request URL:http://www.hw.com.cn/hw-new/d...
Request Method:POST
Status Code:200 OK
Remote Address:110.92.233.12:80
response headers内容:
HTTP/1.1 200 OK
Date: Mon, 30 Jan 2017 06:36:42 GMT
Server: Apache
Content-Disposition: attachment;filename=sz_lrb_123456_2015_2017.zip
Content-Transfer-Encoding: binary
Cache-Control: must-revalidate, post-check=0, pre-check=0
Pragma: public
Content-Length: 1919
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Content-Type: application/octet-stream
request headers内容:
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
Accept-Encoding:gzip, deflate
Accept-Language:zh-CN,zh;q=0.8,en-US;q=0.6,en;q=0.4
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:1108
Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryJnaN0fHu9XUlJhiT
Cookie:JSESSIONID=B97543848676118A0B1671971C2DCBEC
Host:www.hw.com.cn
Origin:http://www.hw.com.cn
Referer:http://www.hw.com.cn/hw-new/i...
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
payload 内容
------WebKitFormBoundaryJnaN0fHu9XUlJhiT
Content-Disposition: form-data; name="K_code"
------WebKitFormBoundaryJnaN0fHu9XUlJhiT
Content-Disposition: form-data; name="market"
sz
------WebKitFormBoundaryJnaN0fHu9XUlJhiT
Content-Disposition: form-data; name="type"
lrb
------WebKitFormBoundaryJnaN0fHu9XUlJhiT
Content-Disposition: form-data; name="code"
123456
------WebKitFormBoundaryJnaN0fHu9XUlJhiT
Content-Disposition: form-data; name="orgid"
gssz0123456
------WebKitFormBoundaryJnaN0fHu9XUlJhiT
Content-Disposition: form-data; name="minYear"
2015
------WebKitFormBoundaryJnaN0fHu9XUlJhiT
Content-Disposition: form-data; name="maxYear"
2017
------WebKitFormBoundaryJnaN0fHu9XUlJhiT
Content-Disposition: form-data; name="hq_code"
------WebKitFormBoundaryJnaN0fHu9XUlJhiT
Content-Disposition: form-data; name="hq_k_code"
------WebKitFormBoundaryJnaN0fHu9XUlJhiT
Content-Disposition: form-data; name="cw_code"
123456
------WebKitFormBoundaryJnaN0fHu9XUlJhiT
Content-Disposition: form-data; name="cw_k_code"
------WebKitFormBoundaryJnaN0fHu9XUlJhiT--
Python
urllib
を使用して投稿リクエストを送信するだけです。 。基礎となる http プロトコルを自分で扱う必要はありません。こちらをご覧ください