From c1d941a200d2d7e01b15f7255a2e03b9a54865d0 Mon Sep 17 00:00:00 2001 From: lucasheld Date: Fri, 30 Dec 2022 21:37:10 +0100 Subject: [PATCH] docs: complete values for uptime kuma 1.19.2 --- tests/test_maintenance.py | 18 ++-- uptime_kuma_api/api.py | 220 +++++++++++++++++++++----------------- 2 files changed, 132 insertions(+), 106 deletions(-) diff --git a/tests/test_maintenance.py b/tests/test_maintenance.py index dc041f7..a298443 100644 --- a/tests/test_maintenance.py +++ b/tests/test_maintenance.py @@ -17,7 +17,7 @@ class TestMaintenance(UptimeKumaTestCase): expected_maintenance = { "title": "maintenance 1", "description": "test", - "strategy": "single", + "strategy": MaintenanceStrategy.SINGLE, "active": True, "intervalDay": 1, "dateRange": [ @@ -113,7 +113,7 @@ class TestMaintenance(UptimeKumaTestCase): expected_maintenance = { "title": "test", "description": "test", - "strategy": "manual", + "strategy": MaintenanceStrategy.MANUAL, "active": True, "intervalDay": 1, "dateRange": [ @@ -122,11 +122,13 @@ class TestMaintenance(UptimeKumaTestCase): "timeRange": [ { "hours": 2, - "minutes": 0 + "minutes": 0, + "seconds": 0 }, { "hours": 3, - "minutes": 0 + "minutes": 0, + "seconds": 0 } ], "weekdays": [], @@ -138,7 +140,7 @@ class TestMaintenance(UptimeKumaTestCase): expected_maintenance = { "title": "test", "description": "test", - "strategy": "single", + "strategy": MaintenanceStrategy.SINGLE, "active": True, "intervalDay": 1, "dateRange": [ @@ -164,7 +166,7 @@ class TestMaintenance(UptimeKumaTestCase): expected_maintenance = { "title": "test", "description": "test", - "strategy": "recurring-interval", + "strategy": MaintenanceStrategy.RECURRING_INTERVAL, "active": True, "intervalDay": 1, "dateRange": [ @@ -190,7 +192,7 @@ class TestMaintenance(UptimeKumaTestCase): expected_maintenance = { "title": "test", "description": "test", - "strategy": "recurring-weekday", + "strategy": MaintenanceStrategy.RECURRING_WEEKDAY, "active": True, "intervalDay": 1, "dateRange": [ @@ -221,7 +223,7 @@ class TestMaintenance(UptimeKumaTestCase): expected_maintenance = { "title": "test", "description": "test", - "strategy": "recurring-day-of-month", + "strategy": MaintenanceStrategy.RECURRING_DAY_OF_MONTH, "active": True, "intervalDay": 1, "dateRange": [ diff --git a/uptime_kuma_api/api.py b/uptime_kuma_api/api.py index 11a6571..428b2e7 100644 --- a/uptime_kuma_api/api.py +++ b/uptime_kuma_api/api.py @@ -764,55 +764,61 @@ class UptimeKumaApi(object): >>> api.get_monitors() [ { - 'id': 1, - 'name': 'Google', - 'url': 'https://google.com', - 'method': 'GET', - 'hostname': None, - 'port': 53, - 'maxretries': 0, - 'weight': 2000, + 'accepted_statuscodes': ['200-299'], 'active': True, - 'type': 'http', - 'interval': 60, - 'retryInterval': 60, - 'resendInterval': 0, - 'keyword': None, - 'expiryNotification': False, - 'ignoreTls': False, - 'upsideDown': False, - 'maxredirects': 10, - 'accepted_statuscodes': [ - '200-299' - ], - 'dns_resolve_type': 'A', - 'dns_resolve_server': '1.1.1.1', - 'dns_last_result': None, - 'pushToken': None, - 'docker_container': None, - 'docker_host': None, - 'proxyId': None, - 'notificationIDList': [], - 'tags': [], - 'maintenance': False, - 'mqttUsername': None, - 'mqttPassword': None, - 'mqttTopic': None, - 'mqttSuccessMessage': None, - 'databaseConnectionString': None, - 'databaseQuery': None, + 'authDomain': None, 'authMethod': '', 'authWorkstation': None, - 'authDomain': None, - 'radiusUsername': None, - 'radiusPassword': None, + 'basic_auth_pass': None, + 'basic_auth_user': None, + 'body': None, + 'databaseConnectionString': None, + 'databaseQuery': None, + 'dns_last_result': None, + 'dns_resolve_server': '1.1.1.1', + 'dns_resolve_type': 'A', + 'docker_container': None, + 'docker_host': None, + 'expiryNotification': False, + 'grpcBody': None, + 'grpcEnableTls': False, + 'grpcMetadata': None, + 'grpcMethod': None, + 'grpcProtobuf': None, + 'grpcServiceName': None, + 'grpcUrl': None, + 'headers': None, + 'hostname': None, + 'id': 1, + 'ignoreTls': False, + 'includeSensitiveData': True, + 'interval': 60, + 'keyword': None, + 'maintenance': False, + 'maxredirects': 10, + 'maxretries': 0, + 'method': 'GET', + 'mqttPassword': None, + 'mqttSuccessMessage': None, + 'mqttTopic': None, + 'mqttUsername': None, + 'name': 'monitor 1', + 'notificationIDList': [1, 2], + 'port': None, + 'proxyId': None, + 'pushToken': None, 'radiusCalledStationId': None, 'radiusCallingStationId': None, + 'radiusPassword': None, 'radiusSecret': None, - 'headers': None, - 'body': None, - 'basic_auth_user': None, - 'basic_auth_pass': None + 'radiusUsername': None, + 'resendInterval': 0, + 'retryInterval': 60, + 'tags': [], + 'type': 'http', + 'upsideDown': False, + 'url': 'http://127.0.0.1', + 'weight': 2000 } ] """ @@ -835,55 +841,61 @@ class UptimeKumaApi(object): >>> api.get_monitor(1) { - 'id': 1, - 'name': 'Google', - 'url': 'https://google.com', - 'method': 'GET', - 'hostname': None, - 'port': 53, - 'maxretries': 0, - 'weight': 2000, + 'accepted_statuscodes': ['200-299'], 'active': True, - 'type': 'http', - 'interval': 60, - 'retryInterval': 60, - 'resendInterval': 0, - 'keyword': None, - 'expiryNotification': False, - 'ignoreTls': False, - 'upsideDown': False, - 'maxredirects': 10, - 'accepted_statuscodes': [ - '200-299' - ], - 'dns_resolve_type': 'A', - 'dns_resolve_server': '1.1.1.1', - 'dns_last_result': None, - 'pushToken': None, - 'docker_container': None, - 'docker_host': None, - 'proxyId': None, - 'notificationIDList': [], - 'tags': [], - 'maintenance': False, - 'mqttUsername': None, - 'mqttPassword': None, - 'mqttTopic': None, - 'mqttSuccessMessage': None, - 'databaseConnectionString': None, - 'databaseQuery': None, + 'authDomain': None, 'authMethod': '', 'authWorkstation': None, - 'authDomain': None, - 'radiusUsername': None, - 'radiusPassword': None, + 'basic_auth_pass': None, + 'basic_auth_user': None, + 'body': None, + 'databaseConnectionString': None, + 'databaseQuery': None, + 'dns_last_result': None, + 'dns_resolve_server': '1.1.1.1', + 'dns_resolve_type': 'A', + 'docker_container': None, + 'docker_host': None, + 'expiryNotification': False, + 'grpcBody': None, + 'grpcEnableTls': False, + 'grpcMetadata': None, + 'grpcMethod': None, + 'grpcProtobuf': None, + 'grpcServiceName': None, + 'grpcUrl': None, + 'headers': None, + 'hostname': None, + 'id': 1, + 'ignoreTls': False, + 'includeSensitiveData': True, + 'interval': 60, + 'keyword': None, + 'maintenance': False, + 'maxredirects': 10, + 'maxretries': 0, + 'method': 'GET', + 'mqttPassword': None, + 'mqttSuccessMessage': None, + 'mqttTopic': None, + 'mqttUsername': None, + 'name': 'monitor 1', + 'notificationIDList': [1, 2], + 'port': None, + 'proxyId': None, + 'pushToken': None, 'radiusCalledStationId': None, 'radiusCallingStationId': None, + 'radiusPassword': None, 'radiusSecret': None, - 'headers': None, - 'body': None, - 'basic_auth_user': None, - 'basic_auth_pass': None + 'radiusUsername': None, + 'resendInterval': 0, + 'retryInterval': 60, + 'tags': [], + 'type': 'http', + 'upsideDown': False, + 'url': 'http://127.0.0.1', + 'weight': 2000 } """ r = self._call('getMonitor', id_)["monitor"] @@ -2782,11 +2794,13 @@ class UptimeKumaApi(object): ... timeRange=[ ... { ... "hours": 2, - ... "minutes": 0 + ... "minutes": 0, + ... "seconds": 0 ... }, ... { ... "hours": 3, - ... "minutes": 0 + ... "minutes": 0, + ... "seconds": 0 ... } ... ], ... weekdays=[], @@ -2812,11 +2826,13 @@ class UptimeKumaApi(object): ... timeRange=[ ... { ... "hours": 2, - ... "minutes": 0 + ... "minutes": 0, + ... "seconds": 0 ... }, ... { ... "hours": 3, - ... "minutes": 0 + ... "minutes": 0, + ... "seconds": 0 ... } ... ], ... weekdays=[], @@ -2842,11 +2858,13 @@ class UptimeKumaApi(object): ... timeRange=[ ... { ... "hours": 2, - ... "minutes": 0 + ... "minutes": 0, + ... "seconds": 0 ... }, ... { ... "hours": 3, - ... "minutes": 0 + ... "minutes": 0, + ... "seconds": 0 ... } ... ], ... weekdays=[], @@ -2872,11 +2890,13 @@ class UptimeKumaApi(object): ... timeRange=[ ... { ... "hours": 2, - ... "minutes": 0 + ... "minutes": 0, + ... "seconds": 0 ... }, ... { ... "hours": 3, - ... "minutes": 0 + ... "minutes": 0, + ... "seconds": 0 ... } ... ], ... weekdays=[ @@ -2907,11 +2927,13 @@ class UptimeKumaApi(object): ... timeRange=[ ... { ... "hours": 2, - ... "minutes": 0 + ... "minutes": 0, + ... "seconds": 0 ... }, ... { ... "hours": 3, - ... "minutes": 0 + ... "minutes": 0, + ... "seconds": 0 ... } ... ], ... weekdays=[], @@ -2958,11 +2980,13 @@ class UptimeKumaApi(object): ... timeRange=[ ... { ... "hours": 2, - ... "minutes": 0 + ... "minutes": 0, + ... "seconds": 0 ... }, ... { ... "hours": 3, - ... "minutes": 0 + ... "minutes": 0, + ... "seconds": 0 ... } ... ], ... weekdays=[],