1
lieh222 2018-08-24 09:36:35 +08:00
response.request.body 打印看看呗
|
2
bestehen OP @lieh222 返回的是 none
我现在是这样写的 files=[("ReportForm[url]",('齐家网 COO 毛新勇:《未来平台赋能是必然,但要真刀真枪才有意义》-18 页.pdf',open(file,'rb'),'Content-Type: application/pdf'))] data={"_csrf":csrf_token} headers=headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36', } response=requests.post(url=url,cookies=cookies,files=files,data=data,headers=headers) print(response.request.body) |
3
bestehen OP 网页源码是这样的
<form id="w0" class="form-horizontal" action="/report/add?_=1535094880131" method="post" enctype="multipart/form-data"> <input type="hidden" name="_csrf" value="4n_OPKuOaFi3F2pKZZwCPje9xQM4aIwKOZiHWUSoOSGnDqls7uo4HY5aAClc0nVhR_OIMloA-D5L3rYGNMdLVA=="><div class="form-group field-reportform-url"> <label class="control-label col-sm-3" for="reportform-url">上传报告</label> <div class="col-sm-6"> <input type="hidden" name="ReportForm[url]" value=""><input type="file" id="reportform-url" class="report_pdf_new" name="ReportForm[url]"> <p class="help-block help-block-error "></p> </div> |