mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 14:14:22 +01:00
Adds exception handling for no schema and timeout
This commit is contained in:
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user