Skip to content

Commit 218a4b0

Browse files
authored
Update maptomethod.py
1 parent e128c31 commit 218a4b0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

maptomethod.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import inspect
22
import logging
3-
import ssl
43
import sys
54
from collections import OrderedDict
65
from re import search as re_search
@@ -22,8 +21,9 @@
2221
from yaml.representer import SafeRepresenter
2322
from yaml.resolver import BaseResolver
2423

25-
# disable ssl verification
26-
ssl._create_default_https_context = ssl._create_unverified_context
24+
SSL_VERIFY = os.getenv("SSL_VERIFY", "True").lower() in ("true", "1", "t")
25+
if not SSL_VERIFY:
26+
requests.packages.urllib3.disable_warnings()
2727

2828

2929
def dict_representer(dumper, data):
@@ -104,6 +104,7 @@ def open_file(uri: AnyUrl,authorization= None) -> Tuple["filedata": str, "filena
104104
if uri_parsed.scheme in ["https", "http"]:
105105
# r = urlopen(uri)
106106
s= requests.Session()
107+
s.verify = SSL_VERIFY
107108
s.headers.update({"Authorization": authorization})
108109
r = s.get(uri, allow_redirects=True, stream=True)
109110

0 commit comments

Comments
 (0)