From 96bf3d887bcb230fa27357744054ac892608b147 Mon Sep 17 00:00:00 2001 From: Arti Zirk Date: Tue, 3 Nov 2020 21:48:15 +0200 Subject: [PATCH] Add more timeouts --- kdoorpi/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kdoorpi/__init__.py b/kdoorpi/__init__.py index 40536c2..8ad80a4 100644 --- a/kdoorpi/__init__.py +++ b/kdoorpi/__init__.py @@ -52,7 +52,7 @@ class Main: def sync_cards(self): logging.info("Downloading users list") - r = self.session.get(self.api_allowed) + r = self.session.get(self.api_allowed, timeout=15) try: allowed_uids = r.json()["allowed_uids"] except JSONDecodeError as e: @@ -81,7 +81,7 @@ class Main: "timestamp": time.strftime("%Y-%m-%d %H:%M:%S") } print(data) - requests.post(self.api_swipe, data=data) + requests.post(self.api_swipe, data=data, timeout=15) def listen_notification(self): while 1: