From 4a17aae946162d490c7aaf0796b1630edaa2e89e Mon Sep 17 00:00:00 2001 From: Adrian Roata Date: Thu, 28 Jan 2021 23:33:05 +0200 Subject: [PATCH] Update sdwan.py --- sdwan.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sdwan.py b/sdwan.py index 674b091..f69ec7f 100755 --- a/sdwan.py +++ b/sdwan.py @@ -18,8 +18,8 @@ import os import tabulate import yaml -from requests.packages.urllib3.exceptions import InsecureRequestWarning -requests.packages.urllib3.disable_warnings(InsecureRequestWarning) +import warnings +warnings.filterwarnings('ignore', message='Unverified HTTPS request') vmanage_host = os.environ.get("vManage_IP") vmanage_port = os.environ.get("vManage_PORT") @@ -50,8 +50,8 @@ def get_jsessionid(vmanage_host, vmanage_port, username, password): jsessionid = cookies.split(";") return(jsessionid[0]) except: - if logger is not None: - logger.error("No valid JSESSION ID returned\n") + if response.status_code != 200: + print("No valid JSESSION ID returned\n") exit() @staticmethod @@ -315,4 +315,4 @@ def detach(target, sysip): if __name__ == "__main__": cli() - \ No newline at end of file +