Catch MaxRetryError

This commit is contained in:
Jakob Lechner 2023-12-24 16:16:24 +00:00
parent 50576ea41f
commit 8b1bb04197
No known key found for this signature in database
GPG key ID: 996082EFB5906C10

View file

@ -16,13 +16,16 @@ def send_open_door_request(host, username, password):
def get_ring_status(host, username, password):
response = urllib3.PoolManager().request(
"GET",
f"http://{host}/local/Doorcom/monitor.cgi?ring=1",
headers=urllib3.make_headers(basic_auth=f"{username}:{password}"),
preload_content=False,
decode_content=True,
)
try:
response = urllib3.PoolManager().request(
"GET",
f"http://{host}/local/Doorcom/monitor.cgi?ring=1",
headers=urllib3.make_headers(basic_auth=f"{username}:{password}"),
preload_content=False,
decode_content=True,
)
except urllib3.exceptions.MaxRetryError:
return
while True:
line = response.readline()