POST 请求这样构建对不对?为啥总不成功

2016-03-12 18:35:09 +08:00
 dsp2138
import requests
import json

url='http://www.spprec.com/sczw/jyfwpt/005001/005001001/MoreInfo.aspx?CategoryNum=005001001'
s = requests.session()

postdata={'__EVENTTARGET': 'MoreInfoList1$Pager', '__EVENTARGUMENT': '3', '__VIEWSTATE': '/wEPDwUKLTU4MzUzNjg5NA9kFgICAQ9kFgJmDw8WBh4LYmdDbGFzc05hbWUFCE1pZGRsZUJnHgtjYXRlZ29yeU51bQUJMDA1MDAxMDAxHgZzaXRlaWQCAWQWAmYPZBYEAgIPZBYCZg9kFgJmDzwrAAsCAA8WCh4LXyFJdGVtQ291bnQCFB4IRGF0YUtleXMWAB4JUGFnZUNvdW50AgEeFV8hRGF0YVNvdXJjZUl0ZW1Db3VudAIUHghQYWdlU2l6ZQIUZAEUKwADZGQ8KwAEAQAWAh4HVmlzaWJsZWcWAmYPZBYoAgIPZBYGZg9kFgJmDxUBKDxpbWcgc3JjPSIvc2N6dy9pbWFnZXMvZG90cy9kb3RfNDAuZ2lmIj5kAgEPZBYCZg8VAasCPGEgaHJlZj0iL3NjencvSW5mb0RldGFpbC9EZWZhdWx0LmFzcHg/SW5mb0lEPTFhMmEzODAwLTY5MWUtNDY4YS1iMmE0LWM0Mzg4ZDIyNGUzNCZDYXRlZ29yeU51bT0wMDUwMDEwMDEiIHRhcmdldD0iX2JsYW5rIiB0aXRsZT0i6YeR5aCC5Y6/MjAxNeW5tOesrOS6jOaJueaWsOS4iuWwj+WfjumVh+aUv+W6nOaKlei1hOmhueebruWLmOWvn+iuvuiuoeaLm+agh+WFrOWRiiI+6YeR5aCC5Y6/MjAxNeW5tOesrOS6jOaJueaWsOS4iuWwj+WfjumVh+aUv+W6nOaKlei1hOmhueebruWLmOWvn+iuvuiuoeaLm+agh+WFrOWRijwvYT5kAgIPZBYCZg8VAQoyMDE2LTAzLTExZAIDD2QWBmYPZBYCZg8VASg8aW1nIHNyYz0iL3NjencvaW1hZ2VzL2Rv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Referer': 'http://www.spprec.com/sczw/jyfwpt/005001/005001001/MoreInfo.aspx?CategoryNum=005001001', 'Accept-Language': 'zh-CN,zh;q=0.8', 'Content-Type': 'application/x-www-form-urlencoded', 'Origin': 'http://www.spprec.com', 'Connection': 'keep-alive', 'Host': 'www.spprec.com', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36'}
r=requests.get(url)

resp = s.post(url,headers=headers,cookies=r.cookies)
5635 次点击
所在节点    Python
49 条回复
dsp2138
2016-03-12 18:37:49 +08:00
具体 postdata 为啥那么长,我也很纳闷我是不是搞错了!
但这个网站竟然将网页全文做为一个变量用 js submit 传送了!!

大虾帮忙分析下,这个 URL 的 post 我这样做对不对!
hansnow
2016-03-12 18:42:08 +08:00
resp = s.post(url,headers=headers,cookies=r.cookies)

data 去哪儿了?
trotyl
2016-03-12 18:43:37 +08:00
你的 postdata 根本就没用过。。不懂你是要干什么。。
dsp2138
2016-03-12 18:45:36 +08:00
@hansnow esp = s.post(url,data=posdate,theaders=headers,cookies=r.cookies)
抱歉,刚修改了,直接复制了!
这样也不行的
dsp2138
2016-03-12 18:46:15 +08:00
@trotyl 源码复制时错了,抱歉
resp = s.post(url,data=posdate,theaders=headers,cookies=r.cookies)
crab
2016-03-12 18:47:52 +08:00
__VIEWSTATE 这个参数值是动态的吧?
dsp2138
2016-03-12 18:50:03 +08:00
@crab 这个我 base64 解码看了下,就是当前页的全文的 html 代码!
具体为啥这么做很是不理解!
Strikeactor
2016-03-12 18:50:44 +08:00
dsp2138
2016-03-12 18:52:35 +08:00
@Strikeactor 我试试看
xuzywozz
2016-03-12 18:55:01 +08:00
heasers 不全?
dsp2138
2016-03-12 18:56:13 +08:00
@xuzywozz 我应该把 get 得到的 headers 都添加上吗?
bdbai
2016-03-12 21:23:19 +08:00
这一大串是 ASP.NET WebForm 生成的。你可以直接访问页面得到那串东西,然后模拟浏览器请求 POST 这样也许会好一点。
xuzywozz
2016-03-12 21:34:46 +08:00
@dsp2138 全加上试试 我遇到几次问题都是 headers 不全造成的
dsp2138
2016-03-12 21:47:47 +08:00
@bdbai 我大概也看明白了, cookies 里面的__CSRFCOOKIE ,和 data 里面的__CSRFTOKEN 是保持一致的!
只是__CSRFTOKEN 的 value 使用了 base64 加密,但又不完全是!__CSRFCOOKIE 的 base64 码和__CSRFTOKEN 不一致!正在琢磨呢
mhycy
2016-03-12 22:03:42 +08:00
能不能说说在干啥?发了那么多次代码没次对的。。。。囧
dsp2138
2016-03-12 22:05:25 +08:00
@mhycy resp = s.post(url,data=data,cookies=cookies,headers=headers)
mhycy
2016-03-12 22:09:30 +08:00
@dsp2138 要干啥?
rcmerci
2016-03-12 22:15:14 +08:00
卧槽点进来吓尿了
just1
2016-03-12 22:15:38 +08:00
header 有的参数是不能加的
dsp2138
2016-03-12 22:20:07 +08:00
@just1 请教,哪些是不能加的?本人对这方面学习甚少!
谢谢

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/263039

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX