Adds exception handling for no schema and timeout

This commit is contained in:
Sergi Delgado Segura
2020-02-13 19:11:51 +01:00
parent 452dbb6bee
commit 1471e89855

View File

@@ -246,6 +246,12 @@ def post_appointment(data):
logger.error("Can't connect to PISA API. Server cannot be reached")
return None
except requests.exceptions.InvalidSchema:
logger.error("No transport protocol found. Have you missed http(s):// in the server url?")
except requests.exceptions.Timeout:
logger.error("The request timed out")
def process_post_appointment_response(response):
"""
@@ -352,6 +358,12 @@ def get_appointment(locator):
logger.error("Can't connect to PISA API. Server cannot be reached")
return None
except requests.exceptions.InvalidSchema:
logger.error("No transport protocol found. Have you missed http(s):// in the server url?")
except requests.exceptions.Timeout:
logger.error("The request timed out")
def show_usage():
return (