diff --git a/DQMServices/FileIO/scripts/visDQMUpload.py b/DQMServices/FileIO/scripts/visDQMUpload.py index a850f0421d71e..b6d981635c65d 100755 --- a/DQMServices/FileIO/scripts/visDQMUpload.py +++ b/DQMServices/FileIO/scripts/visDQMUpload.py @@ -7,6 +7,7 @@ import string import mimetypes import http.client as httplib +import ssl import gzip import hashlib from stat import * @@ -33,10 +34,15 @@ ssl_key_file = None ssl_cert_file = None +context = None class HTTPSCertAuth(HTTPS): - def __init__(self, host, *args, **kwargs): - HTTPS.__init__(self, host, key_file = ssl_key_file, cert_file = ssl_cert_file, **kwargs) + def __init__(self, host, context = None, *args, **kwargs): + if context is None: + context = ssl._create_default_https_context() + if ssl_key_file or ssl_cert_file: + context.load_cert_chain(ssl_cert_file, ssl_key_file) + HTTPS.__init__(self, host, context = context, **kwargs) class HTTPSCertAuthenticate(urllib2.AbstractHTTPHandler): def default_open(self, req):