mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Fix wrong namespaces
This commit is contained in:
parent
c369bc1a74
commit
48cc60b11c
@ -267,10 +267,10 @@ def query(url,
|
||||
result_text = result.text
|
||||
result_cookies = result.cookies
|
||||
else:
|
||||
request = urllib.Request(url, data)
|
||||
request = urllib.request.Request(url, data)
|
||||
handlers = [
|
||||
urllib.HTTPHandler,
|
||||
urllib.HTTPCookieProcessor(sess_cookies)
|
||||
urllib.request.HTTPHandler,
|
||||
urllib.request.HTTPCookieProcessor(sess_cookies)
|
||||
]
|
||||
|
||||
if url.startswith('https') or port == 443:
|
||||
@ -316,7 +316,7 @@ def query(url,
|
||||
if hasattr(ssl, 'SSLContext'):
|
||||
# Python >= 2.7.9
|
||||
context = ssl.SSLContext.load_cert_chain(*cert_chain)
|
||||
handlers.append(urllib.HTTPSHandler(context=context)) # pylint: disable=E1123
|
||||
handlers.append(urllib.request.HTTPSHandler(context=context)) # pylint: disable=E1123
|
||||
else:
|
||||
# Python < 2.7.9
|
||||
cert_kwargs = {
|
||||
@ -328,7 +328,7 @@ def query(url,
|
||||
cert_kwargs['key_file'] = cert_chain[1]
|
||||
handlers[0] = salt.ext.six.moves.http_client.HTTPSConnection(**cert_kwargs)
|
||||
|
||||
opener = urllib.build_opener(*handlers)
|
||||
opener = urllib.request.build_opener(*handlers)
|
||||
for header in header_dict:
|
||||
request.add_header(header, header_dict[header])
|
||||
request.get_method = lambda: method
|
||||
|
Loading…
Reference in New Issue
Block a user