Add new setting to verify outgoing SSL connections

The new setting 'verify_ssl_connections' tells the requests library to
verify secured outgoing HTTP connections.
Usually verifying is desired and helps to reveal configuration
problems. It also disables an ugly warning when HTTPS connections
are made without verification.
This commit is contained in:
Enrico Tröger
2020-01-25 19:44:11 +01:00
parent 1cd423041c
commit 68843d9664
7 changed files with 50 additions and 19 deletions

View File

@ -24,11 +24,12 @@ def fetch_remote(remote_url,
accept=None,
params=None,
timeout=None,
headers=None):
headers=None,
verify=True):
if data is not None and type(data) != str:
data = json.dumps(data)
verify = False
verify = bool(verify) # enforce type boolean
our_headers = {
'user-agent': 'powerdnsadmin/0',
@ -64,13 +65,15 @@ def fetch_json(remote_url,
data=None,
params=None,
headers=None,
timeout=None):
timeout=None,
verify=True):
r = fetch_remote(remote_url,
method=method,
data=data,
params=params,
headers=headers,
timeout=timeout,
verify=verify,
accept='application/json; q=1')
if method == "DELETE":