diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/certtools.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/certtools.py b/tools/certtools.py index 919460e..69e376d 100644 --- a/tools/certtools.py +++ b/tools/certtools.py @@ -102,12 +102,18 @@ def create_ssl_context(cafile=None): def urlget(url, params=None): with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=requests.packages.urllib3.exceptions.SubjectAltNameWarning) + try: + warnings.filterwarnings("ignore", category=requests.packages.urllib3.exceptions.SubjectAltNameWarning) + except AttributeError: + pass return requests.get(url, verify=sslparameters.cafile, params=params) def urlpost(url, data): with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=requests.packages.urllib3.exceptions.SubjectAltNameWarning) + try: + warnings.filterwarnings("ignore", category=requests.packages.urllib3.exceptions.SubjectAltNameWarning) + except AttributeError: + pass return requests.post(url, data=data, verify=sslparameters.cafile) def get_sth(baseurl): @@ -282,7 +288,10 @@ def http_request(url, data=None, key=None, verifynode=None, publickeydir=".", pa sigencode=ecdsa.util.sigencode_der) prepared_req.headers['X-Catlfish-Auth'] = base64.b64encode(signature) + ";key=" + keyname with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=requests.packages.urllib3.exceptions.SubjectAltNameWarning) + try: + warnings.filterwarnings("ignore", category=requests.packages.urllib3.exceptions.SubjectAltNameWarning) + except AttributeError: + pass result = session.send(prepared_req, verify=sslparameters.cafile) result.raise_for_status() authheader = result.headers.get('X-Catlfish-Auth') |