mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-05-19 14:16:47 -04:00
Change default timeout to 10 seconds,
match request timeout to script timeout -1 second. Always use at least 1 sec. timeout for request.
This commit is contained in:
@@ -306,7 +306,7 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_value": 5,
|
||||
"default_value": 10,
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
|
||||
@@ -23,12 +23,13 @@ def main():
|
||||
url = get_setting_value(f'{pluginName}_URL')
|
||||
user = get_setting_value(f'{pluginName}_USER')
|
||||
password = get_setting_value(f'{pluginName}_PASS')
|
||||
timeout = get_setting_value(f'{pluginName}_RUN_TIMEOUT')
|
||||
|
||||
mylog('verbose', [f'[{pluginName}] Querying Kea API at {url}'])
|
||||
|
||||
payload = {'command': 'lease4-get-all', 'service': ['dhcp4']}
|
||||
|
||||
response = requests.post(url, json=payload, auth=(user, password), timeout=10)
|
||||
response = requests.post(url, json=payload, auth=(user, password), timeout=max(1, timeout - 1))
|
||||
response.raise_for_status()
|
||||
data = response.json()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user