From d29d908b61439b44701688b2bc64401a04cf7207 Mon Sep 17 00:00:00 2001 From: lucasheld Date: Tue, 2 Aug 2022 11:58:49 +0200 Subject: [PATCH] support for python 3.6 --- uptime_kuma_api/api.py | 29 +++++++++++++++++++++-------- uptime_kuma_api/converter.py | 2 +- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/uptime_kuma_api/api.py b/uptime_kuma_api/api.py index ff69fd8..5a70626 100644 --- a/uptime_kuma_api/api.py +++ b/uptime_kuma_api/api.py @@ -34,14 +34,14 @@ def _build_monitor_data( retries: int = 0, upside_down_mode: bool = False, tags: list = None, - notification_ids: list[int] = None, + notification_ids: list = None, # HTTP, KEYWORD url: str = None, certificate_expiry_notification: bool = False, ignore_tls_error: bool = False, max_redirects: int = 10, - accepted_status_codes: list[str] = None, + accepted_status_codes: list = None, proxy_id: int = None, http_method: str = "GET", http_body: str = None, @@ -72,8 +72,14 @@ def _build_monitor_data( mqtt_success_message: str = None, # SQLSERVER - sqlserver_connection_string: str = "Server=,;Database=;User Id=;Password=;Encrypt=;TrustServerCertificate=;Connection Timeout=", - sqlserver_query: str = None, + sqlserver_connection_string: str = "Server=,;" + "Database=;" + "User Id=;" + "Password=;" + "Encrypt=;" + "TrustServerCertificate=;" + "Connection Timeout=", + sqlserver_query: str = None ): if not accepted_status_codes: accepted_status_codes = ["200-299"] @@ -167,11 +173,18 @@ def _build_monitor_data( return data -def _build_notification_data(name: str, type_: NotificationType, default: bool = False, apply_existing: bool = False, **kwargs): +def _build_notification_data( + name: str, + type_: NotificationType, + default: bool = False, + apply_existing: bool = False, + **kwargs +): data = { "name": name, "type_": type_, "default": default, + "apply_existing": apply_existing, **kwargs } data = convert_to_socket(params_map_notification_and_provider, data) @@ -214,7 +227,7 @@ def _build_status_page_data( theme: str = "light", published: bool = True, show_tags: bool = False, - domain_name_list: list[str] = None, + domain_name_list: list = None, custom_css: str = "", footer_text: str = None, show_powered_by: bool = True, @@ -366,7 +379,7 @@ class UptimeKumaApi(object): def __init__(self, url): self.sio = socketio.Client() - self._event_data: dict[str, any] = { + self._event_data = { "monitorList": None, "notificationList": None, "proxyList": None, @@ -780,7 +793,7 @@ class UptimeKumaApi(object): steam_api_key: str = "", # notifications - tls_expiry_notify_days: list[int] = None, + tls_expiry_notify_days: list = None, # security disable_auth: bool = False diff --git a/uptime_kuma_api/converter.py b/uptime_kuma_api/converter.py index 0e6456e..4c85a79 100644 --- a/uptime_kuma_api/converter.py +++ b/uptime_kuma_api/converter.py @@ -208,7 +208,7 @@ params_map_settings = { } -def _convert_to_from_socket(params_map: dict[str, str], params, to_socket=False): +def _convert_to_from_socket(params_map: dict, params, to_socket=False): if type(params) == list: out = [] params_list = params