简体   繁体   中英

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

Broswer shows page not found but request module gives 200 as status code

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]>

Given Two URL, the browser works fine for the first URL but gives error for the second one which it should but while checking the same with the python request module it gives 200 as status code for the both. Attached image for reference.

YOU won't be able to open the URL as it is not accessible outside.

The site " http://abc.us.gib.com/tool/cluster.jsphttp://abc.us.gib.com/tool/cluster.jsp " returns wrong status code. Requests module works fine. You can check in a browser what status code above site returns.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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