Add some logging

This commit is contained in:
Jakob Lechner 2024-01-30 20:11:08 +00:00
parent 920fdb5955
commit 91b720e26b

View file

@ -21,10 +21,12 @@ def send_open_door_request(host, username, password):
def get_ring_status(host, username, password):
url = f"http://{host}/local/Doorcom/monitor.cgi?ring=1"
print(f"sending request to {url}", flush=True)
try:
response = urllib3.PoolManager().request(
"GET",
f"http://{host}/local/Doorcom/monitor.cgi?ring=1",
url,
headers=urllib3.make_headers(basic_auth=f"{username}:{password}"),
preload_content=False,
decode_content=True,
@ -48,6 +50,7 @@ def get_ring_status(host, username, password):
data.append(line.decode().rstrip())
else:
if data:
print(f"received: {data}", flush=True)
yield data
break