Curl/python请求发送请求并绕过< !-- a padding to disable MSIE and Chrome friendly error page -->

mrwjdhj3  于 2023-01-27  发布在  Python
关注(0)|答案(1)|浏览(5640)

我想用curl或python的requests模块向站点发送请求,但收到的是503
如何在curl或python请求中解决这个问题?

from requests import post

json = {"somedata": "somevalue"}
cookies = {"somecookie": "somevalue"}
headers = {"someheader": "somevalue"}

print(post("https://www.example.com/", cookies=cookies, data=json, headers=headers).text)

输出:

<html>
<head><title>503 Service Temporarily Unavailable</title></head>
<body>
<center><h1>503 Service Temporarily Unavailable</h1></center>
<hr><center>Site</center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->

curl 也是一样。
我只想正常发送请求,例如:

from requests import post

json = {"somedata": "somevalue"}
cookies = {"somecookie": "somevalue"}
headers = {"someheader": "somevalue"}

print(post("https://www.example.com/", cookies=cookies, data=json, headers=headers).text)

输出:

{
  "success":true
}
eimct9ow

eimct9ow1#

“填充以禁用MSIE和Chrome友好错误页”错误可能由于几个原因而发生,包括临时服务器问题、浏览器缓存错误、DNS问题,甚至服务器问题。
503代码通常意味着服务器暂时无法处理请求,所以这可能不是您的错。

相关问题