mirror of
https://github.com/NaN-tic/trytond-monitoring_network.git
synced 2023-12-14 03:42:58 +01:00
Ensure client certificate is not checked in python >= 2.7.9.
This commit is contained in:
parent
02189f20e5
commit
fcdb38d54f
|
@ -1,5 +1,7 @@
|
|||
# The COPYRIGHT file at the top level of this repository contains the full
|
||||
# copyright notices and license terms.
|
||||
import sys
|
||||
import ssl
|
||||
import subprocess
|
||||
import json
|
||||
import nmap
|
||||
|
@ -57,6 +59,14 @@ class CheckPlan:
|
|||
for url in urls:
|
||||
server = ServerProxy(url, verbose=0)
|
||||
try:
|
||||
if sys.version_info[:3] < (2, 7, 9):
|
||||
server = xmlrpclib.ServerProxy(uri, allow_none=True)
|
||||
else:
|
||||
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)
|
||||
databases = server.common.db.list(None, None)
|
||||
except Exception, e:
|
||||
res.append({
|
||||
|
|
Loading…
Reference in a new issue