From 11fee81486f98cfd21684ebbd0537f709fc8f05b Mon Sep 17 00:00:00 2001 From: Tony Fernandez Date: Fri, 25 Oct 2024 17:28:02 -0400 Subject: [PATCH] converted string to dictionary as requested --- borgmatic/hooks/zabbix.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/borgmatic/hooks/zabbix.py b/borgmatic/hooks/zabbix.py index ef16633a..a682eaac 100644 --- a/borgmatic/hooks/zabbix.py +++ b/borgmatic/hooks/zabbix.py @@ -82,12 +82,17 @@ def ping_monitor(hook_config, config, config_filename, state, monitoring_log_lev elif (username and password) is not None: logger.info(f'{config_filename}: Using user/pass auth with user {username} for Zabbix') + auth_data = { + "jsonrpc": "2.0", + "method": "user.login", + "params": { + "username": username, + "password": password + }, + "id": 1 + } if not dry_run: - response = requests.post( - base_url, - headers=headers, - data=f'{{"jsonrpc":"2.0","method":"user.login","params":{{"username":"{username}","password":"{password}"}},"id":1}}', - ) + response = requests.post(base_url, headers=headers, json=auth_data) data['auth'] = response.json().get('result') elif username is not None: