fix: catch error if server is not reachable
This commit is contained in:
parent
b24ea7530f
commit
a0c463d466
@ -26,10 +26,15 @@ del(data)
|
|||||||
|
|
||||||
|
|
||||||
def check_login(login: str) -> bool:
|
def check_login(login: str) -> bool:
|
||||||
response = get(url=":".join([SERVER, str(PORT)]) + '/scan2kasse/login', json={'login': login})
|
try:
|
||||||
if response.status_code == 200:
|
response = get(url=":".join([SERVER, str(PORT)]) + '/scan2kasse/login', json={'login': login})
|
||||||
return True
|
except Exception as e:
|
||||||
return False
|
LOGGER.exception(e)
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
if response.status_code == 200:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def send_scan(user: str, scanned: dict[int: int], date:str = None):
|
def send_scan(user: str, scanned: dict[int: int], date:str = None):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user