ssl.create_default_context() is not available in all Python versions so it

should be wrapped inside the try-except clause too.
This commit is contained in:
Albert Cervera i Areny 2015-04-15 07:26:55 +02:00
parent 03653a85c9
commit 9c664d886a
1 changed files with 3 additions and 3 deletions

View File

@ -914,10 +914,10 @@ class Asset:
uri = config.get('monitoring', 'uri')
username = config.get('monitoring', 'username')
password = config.get('monitoring', 'password')
ssl_context = ssl.create_default_context()
ssl_context.check_hostname = False
ssl_context.verify_mode = ssl.CERT_NONE
try:
ssl_context = ssl.create_default_context()
ssl_context.check_hostname = False
ssl_context.verify_mode = ssl.CERT_NONE
server = xmlrpclib.ServerProxy(uri, allow_none=True,
context=ssl_context)
except: