Catch MaxRetryError
This commit is contained in:
parent
50576ea41f
commit
8b1bb04197
1 changed files with 10 additions and 7 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue