【发布时间】:2018-03-17 04:08:43
【问题描述】:
我刚刚写了这个:
try:
r = requests.get('http://example.com')
except requests.exceptions.ConnectionError as e:
print(e)
我得到了这个输出:
('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))
有谁知道我怎样才能得到不同类型的连接错误?像此异常中的“连接中止”、“连接被拒绝”和“连接重置”并处理它们?
【问题讨论】:
标签: python exception python-requests