From 5e6a6865e51a044f827dddde0b2e87ae65c80c30 Mon Sep 17 00:00:00 2001
From: Jorrit Schaap <schaap@astron.nl>
Date: Fri, 21 Oct 2022 10:37:15 +0200
Subject: [PATCH] disabled InsecureRequestWarning

---
 SAS/TMSS/client/lib/tmss_http_rest_client.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/SAS/TMSS/client/lib/tmss_http_rest_client.py b/SAS/TMSS/client/lib/tmss_http_rest_client.py
index ef61474f0a8..8b0226778d6 100644
--- a/SAS/TMSS/client/lib/tmss_http_rest_client.py
+++ b/SAS/TMSS/client/lib/tmss_http_rest_client.py
@@ -5,10 +5,18 @@ import typing
 logger = logging.getLogger(__name__)
 
 # see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
+# and https://stackoverflow.com/questions/27981545/suppress-insecurerequestwarning-unverified-https-request-is-being-made-in-pytho
 import urllib3
-urllib3.disable_warnings()
-
 import requests
+if requests.__version__ >= '2.16.0':
+    urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
+else:
+    try:
+        from requests.packages.urllib3.exceptions import InsecureRequestWarning
+        requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
+    except ImportError:
+        pass
+
 from http.client import responses
 import os
 try:
-- 
GitLab