Python请求MaxRetryError提高连接错误适配器.PY(如何捕获不良连接?)



我正在编写一个脚本,该脚本试图在使用基本验证和请求时登录。它有效地工作,但是我需要捕获目前正在下降的IP。当我尝试连接到这样的链接时:

While ..... :
       For .. in ..
          .....
          with r = requests.get('http://' + ip , auth=(username, password))
          ...
       Except e

它引起了这样的错误。

文件" c: python33 lib lib site-packages requests adapters.py",第378行,在发送 提高Connection Error(e)

你能帮我吗?发布发布:D

我用

修复了它
except:
                print("Oops!  Something went wrong, the ip is probably unreachable. Try agai")
                pass

最新更新