繁体   English   中英

当浏览器给出404时,python库中的request模块给出的状态码为200

[英]request module in python library gives status code as 200 when the browser gives 404

Broswer显示页面未找到,但请求模块给出200作为状态码

In[23]:  requests.get("http://abc.us.gib.com/tool/cluster.jsp")
Out[23]: <Response [200]>
In[24]:  requests.get("http://abc.us.gib.com/tool/cluster.jsphttp://abc.us.gib.com/tool/cluster.jsp")
Out[24]: <Response [200]>

给定两个URL,浏览器对于第一个URL可以正常工作,但对于第二个URL却应该提供错误,但是在与python request模块检查相同的同时,它给出了两个的状态码。 所附图片供参考。

您将无法打开该URL,因为无法从外部访问该URL。

网站“ http://abc.us.gib.com/tool/cluster.jsphttp://abc.us.gib.com/tool/cluster.jsp ”返回错误的状态代码。 请求模块工作正常。 您可以在浏览器中检查网站上方返回的状态代码。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM