From a1e8bbbb09d9a038bac0f96e186028997bc34a89 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Thu, 4 Feb 2021 14:39:04 -0600 Subject: [PATCH] Catch OSError to avoid socket leak --- adafruit_requests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_requests.py b/adafruit_requests.py index 8abd58b..f10a342 100644 --- a/adafruit_requests.py +++ b/adafruit_requests.py @@ -560,7 +560,7 @@ def request( ok = True try: self._send_request(socket, host, method, path, headers, data, json) - except _SendFailed: + except (_SendFailed, OSError): ok = False if ok: # Read the H of "HTTP/1.1" to make sure the socket is alive. send can appear to work