Please help see, has got two days to collapse...
Target site: https://www.machiningcloud.com/app/search/kennametal/productcatalog/node/3542257
Methods: the POST
The browser requests and corresponding:
The "machiningcloudsessiontoken" is available in headers,
I:
The import requests, json
Url1='https://production.machiningcloud.com/Server/3.5.1.1/Webservices/ToolProduct.svc/ListNodeCalloutValuesForChildren'
Headers={
'accept' : 'application/json,
'authority' : 'production.machiningcloud.com',
Fe77fa074a45b42bae52c0d67d7aaf26d915009f01ac584 'machiningcloudsessiontoken', '7',
'referer:' https://www.machiningcloud.com/',
'the content-type:' application/json,
'the user-agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64. X64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 '
}
data=https://bbs.csdn.net/topics/{
"AssemblyConnectionContext" : "null", "WithinNodeId" : 3542257,
"IncludeInActiveCstSupport" : "false", "AdditionalPropIds" : "[1720]," "the QueryString" : 'null'
}
Data [" QueryContextFields "]={" Brands ": [2]," Unit ": 2," LanguageId ": 1," SearchBasis ": 3," UseStagingDatabase ":" false "}
Ss=requests. The session ()
Ss. Headers. Update (headers)
Resp=ss. Post (url1, json=data)
Print (resp. Status_code)
Results back:
500
[Finished in 1.6 s]
CodePudding user response:
Is done, the original post data formats have asked (json and data), according to the headers in 'the content-type:' application/json, judge need to post the json data, and the request. The post (url, json=data), the data dictionary format, don't need to json. The loads () function transform!CodePudding user response:
How do you fix, consult