【发布时间】:2018-10-28 17:02:47
【问题描述】:
如果我打开一个链接,如何在 python 中获取 http 状态码? 我是这样做的,但是即使页面抛出 404 错误,它总是显示 200...
from urllib.request import *
self.driver.get(link)
code = urlopen(link).getcode()
if not code == 200:
print('http status: ' + str(code))
【问题讨论】:
标签: python selenium webdriver http-status-codes