From 1471e8985549ee798681b3ae121f59baf0e5e2ac Mon Sep 17 00:00:00 2001 From: Sergi Delgado Segura Date: Thu, 13 Feb 2020 19:11:51 +0100 Subject: [PATCH] Adds exception handling for no schema and timeout --- apps/cli/wt_cli.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/cli/wt_cli.py b/apps/cli/wt_cli.py index 1da8936..6a08b3b 100644 --- a/apps/cli/wt_cli.py +++ b/apps/cli/wt_cli.py @@ -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 (