Skip to content

Commit f98dbfc

Browse files
Copilotalebmorais
andcommitted
Fix AttributeError when requests is not installed
Co-authored-by: alebmorais <196795598+alebmorais@users.noreply.github.com>
1 parent d8e2ac7 commit f98dbfc

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

ClienteWindows

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,11 @@ class WindowsDesktopClient:
320320
return response.status_code < 500
321321
with urllib_request.urlopen(self.pi_url, timeout=timeout) as response:
322322
return 200 <= getattr(response, "status", 200) < 500
323-
except (requests.exceptions.RequestException, urllib_request.URLError):
323+
except urllib_request.URLError:
324+
return False
325+
except Exception:
326+
# Catch requests.exceptions.RequestException when requests is available
327+
# or any other unexpected error
324328
return False
325329

326330
def create_header(self):

0 commit comments

Comments
 (0)