From 4e008271558897843ea00de495e806fe69e45549 Mon Sep 17 00:00:00 2001 From: meisterfischy Date: Wed, 5 Oct 2022 16:47:31 +0200 Subject: API url as parameter --- plugins/check_nextcloud | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/check_nextcloud b/plugins/check_nextcloud index 45411d8..ceebd6d 100755 --- a/plugins/check_nextcloud +++ b/plugins/check_nextcloud @@ -28,6 +28,7 @@ def dict_to_list(dic): parser = argparse.ArgumentParser(description='Check nextcloud status via api') parser.add_argument('-t', dest='token', action='store', type=str, required=True) +parser.add_argument('--url', dest='url', action='store', type=str, required=True) parser.add_argument('-u', dest='max_conns', action='store', type=int, default=None, nargs=2) parser.add_argument('-c', dest='opcache', action='store', type=float, default=None, nargs=2) parser.add_argument('-a', dest='updates', action='store_true', help='check for app updates') @@ -66,7 +67,7 @@ def check_app_updates(data_json) -> Check: return Check('OK', 'No app updates were found.', None) try: - data_json = requests.get('https://nextcloud.my.cum.re/ocs/v2.php/apps/serverinfo/api/v1/info?format=json' + data_json = requests.get(args.url + '?format=json' , headers={'NC-Token': args.token}).json() if data_json['ocs']['meta']['status'] == 'failure': raise APIError('API call failed!') -- cgit v1.2.3