Add more timeouts

This commit is contained in:
Arti Zirk 2020-11-03 21:48:15 +02:00
parent d2de4e13d7
commit 96bf3d887b

View File

@ -52,7 +52,7 @@ class Main:
def sync_cards(self): def sync_cards(self):
logging.info("Downloading users list") logging.info("Downloading users list")
r = self.session.get(self.api_allowed) r = self.session.get(self.api_allowed, timeout=15)
try: try:
allowed_uids = r.json()["allowed_uids"] allowed_uids = r.json()["allowed_uids"]
except JSONDecodeError as e: except JSONDecodeError as e:
@ -81,7 +81,7 @@ class Main:
"timestamp": time.strftime("%Y-%m-%d %H:%M:%S") "timestamp": time.strftime("%Y-%m-%d %H:%M:%S")
} }
print(data) print(data)
requests.post(self.api_swipe, data=data) requests.post(self.api_swipe, data=data, timeout=15)
def listen_notification(self): def listen_notification(self):
while 1: while 1: