复制所得到的内容
curl 'https://www.wlstock.com/ajaxRequrst/StockFundFlowAjax.ashx?act=3' -H 'Connection: keep-alive' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Origin: https://www.wlstock.com' -H 'X-Requested-With: XMLHttpRequest' -H 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Sec-Fetch-Site: same-origin' -H 'Sec-Fetch-Mode: cors' -H 'Referer: https://www.wlstock.com/hudong/stockfundflow.aspx?stockno=002466' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7' -H 'Cookie: __utma=1.1098944855.1629363027.1629363027.1629363027.1; __utmz=1.1629363027.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); HWWAFSESID=4cf4679b97f4a3e6d6; HWWAFSESTIME=1629366513360; Hm_lvt_16ae844519b6d6a721828d6914c625ff=1629363027,1629363561,1629364787,1629366513; Hm_lpvt_16ae844519b6d6a721828d6914c625ff=1629366513; __utmc=1; __utmt=1; __utmb=1.30.10.1629363027' --data 'stockNo=002466&pageIndex=2' --compressed
这个是JSON的方式
{
"data":"stockNo=002466&pageIndex=2",
"method":"POST",
"url":"https://www.wlstock.com/ajaxRequrst/StockFundFlowAjax.ashx?act=3",
"headers":{
"Accept":" application/json, text/javascript, */*; q=0.01",
"Accept-Encoding":" gzip, deflate, br",
"Accept-Language":" zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
"Connection":" keep-alive",
"Content-Type":" application/x-www-form-urlencoded; charset=UTF-8",
"Cookie":" __utma=1.1098944855.1629363027.1629363027.1629363027.1; __utmz=1.1629363027.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); HWWAFSESID=4cf4679b97f4a3e6d6; HWWAFSESTIME=1629366513360; Hm_lvt_16ae844519b6d6a721828d6914c625ff=1629363027,1629363561,1629364787,1629366513; Hm_lpvt_16ae844519b6d6a721828d6914c625ff=1629366513; __utmc=1; __utmt=1; __utmb=1.30.10.1629363027",
"Origin":" https://www.wlstock.com",
"Referer":" https://www.wlstock.com/hudong/stockfundflow.aspx?stockno=002466",
"Sec-Fetch-Mode":" cors",
"Sec-Fetch-Site":" same-origin",
"User-Agent":" Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36",
"X-Requested-With":" XMLHttpRequest"
}
}
python的方式
import requests
headers = {
'Connection': 'keep-alive',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Origin': 'https://www.wlstock.com',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7',
'Sec-Fetch-Site': 'same-origin',
'Cookie': '__utma=1.1098944855.1629363027.1629363027.1629363027.1; __utmz=1.1629363027.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); HWWAFSESID=4cf4679b97f4a3e6d6; HWWAFSESTIME=1629366513360; Hm_lvt_16ae844519b6d6a721828d6914c625ff=1629363027,1629363561,1629364787,1629366513; Hm_lpvt_16ae844519b6d6a721828d6914c625ff=1629366513; __utmc=1; __utmt=1; __utmb=1.30.10.1629363027',
'Accept-Encoding': 'gzip, deflate, br',
'Referer': 'https://www.wlstock.com/hudong/stockfundflow.aspx?stockno=002466',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36',
'X-Requested-With': 'XMLHttpRequest',
'Sec-Fetch-Mode': 'cors',
'Accept': 'application/json, text/javascript, */*; q=0.01',
}
data = 'stockNo=002466&pageIndex=2'
response = requests.post('https://www.wlstock.com/ajaxRequrst/StockFundFlowAjax.ashx?act=3', headers=headers, data=data)