1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-23 17:34:17 +03:00

Make 3.5 client compatible with python 3.6

This commit is contained in:
Adolfo Gómez García 2021-09-29 13:42:26 +02:00
parent 41aa22fadd
commit dcb7b3e28e

View File

@ -185,8 +185,8 @@ class RestApi:
) -> typing.Any:
print('Open')
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
ctx.check_hostname = False
ctx.load_verify_locations(tools.getCaCertsFile())
hostname = urllib.parse.urlparse(url)[1]
serial = ''
@ -212,8 +212,8 @@ class RestApi:
serial = hex(cert.serial_number)[2:]
response = None
ctx.check_hostname = True
ctx.verify_mode = ssl.CERT_REQUIRED
ctx.check_hostname = True
def urlopen(url: str):
# Generate the request with the headers
@ -232,8 +232,8 @@ class RestApi:
# Ask about invalid certificate
if certErrorCallback:
if certErrorCallback(hostname, serial):
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
ctx.check_hostname = False
response = urlopen(url)
else:
raise