使用requests.post,但一直要在headers中设置相应的Content-Type和Referer
# coding=utf-8
import urllib2
import requests
url='http://******/registerService.dwrValidateName.dwr'
postdata={
"callCount":"1",
"page":"/website/reg/regstep.htm",
"httpSessionId":"",
"scriptSessionId":"3CB34EBAAFDFBEB4EFA7B2052C8392F9622",
"c0-scriptName":"registerService",
"c0-methodName":"dwrValidateName",
"c0-id":"0",
"c0-param0":"string:admin",
"batchId":"3"
}
headers={"Content-Type":"text/plain",
'Referer': 'http://********/regstep.htm'}
html=requests.post(url,data=udata,headers=headers)
print html.text