我试图用一家公司的API来获取一个网页,它在Postman中工作得很好,但是当我把Postman生成的代码放入python请求中时,它会返回一个不同的响应。在
我设置了我的代理并添加了我的基本身份验证,但它仍然不起作用url = "https://www.test.com/confluence/rest/api/content/"
querystring = {"expand":"space,body.view,version,container"}
headers = {
'Content-Type': "application/json",
'Authorization': "****",
'User-Agent': "PostmanRuntime/7.15.2",
'Accept': "*/*",
'Cache-Control': "no-cache",
'Postman-Token': "****",
'Host': "www.test.com",
'Cookie': "****",
'Accept-Encoding': "gzip, deflate",
'Connection': "keep-alive",
'cache-control': "no-cache"
}
response = requests.request("GET", url, headers=headers, params=querystring, proxies=urllib.request.getproxies())
Postman返回一个JSON响应,其中包含整个webpage+ID和任何其他必要的信息。
Python返回一个嵌入了此错误的HTML网页
^{pr2}$