forked from DGNum/uptime-kuma-api
support for python 3.6
This commit is contained in:
parent
e1da9708c6
commit
d29d908b61
2 changed files with 22 additions and 9 deletions
|
@ -34,14 +34,14 @@ def _build_monitor_data(
|
||||||
retries: int = 0,
|
retries: int = 0,
|
||||||
upside_down_mode: bool = False,
|
upside_down_mode: bool = False,
|
||||||
tags: list = None,
|
tags: list = None,
|
||||||
notification_ids: list[int] = None,
|
notification_ids: list = None,
|
||||||
|
|
||||||
# HTTP, KEYWORD
|
# HTTP, KEYWORD
|
||||||
url: str = None,
|
url: str = None,
|
||||||
certificate_expiry_notification: bool = False,
|
certificate_expiry_notification: bool = False,
|
||||||
ignore_tls_error: bool = False,
|
ignore_tls_error: bool = False,
|
||||||
max_redirects: int = 10,
|
max_redirects: int = 10,
|
||||||
accepted_status_codes: list[str] = None,
|
accepted_status_codes: list = None,
|
||||||
proxy_id: int = None,
|
proxy_id: int = None,
|
||||||
http_method: str = "GET",
|
http_method: str = "GET",
|
||||||
http_body: str = None,
|
http_body: str = None,
|
||||||
|
@ -72,8 +72,14 @@ def _build_monitor_data(
|
||||||
mqtt_success_message: str = None,
|
mqtt_success_message: str = None,
|
||||||
|
|
||||||
# SQLSERVER
|
# SQLSERVER
|
||||||
sqlserver_connection_string: str = "Server=<hostname>,<port>;Database=<your database>;User Id=<your user id>;Password=<your password>;Encrypt=<true/false>;TrustServerCertificate=<Yes/No>;Connection Timeout=<int>",
|
sqlserver_connection_string: str = "Server=<hostname>,<port>;"
|
||||||
sqlserver_query: str = None,
|
"Database=<your database>;"
|
||||||
|
"User Id=<your user id>;"
|
||||||
|
"Password=<your password>;"
|
||||||
|
"Encrypt=<true/false>;"
|
||||||
|
"TrustServerCertificate=<Yes/No>;"
|
||||||
|
"Connection Timeout=<int>",
|
||||||
|
sqlserver_query: str = None
|
||||||
):
|
):
|
||||||
if not accepted_status_codes:
|
if not accepted_status_codes:
|
||||||
accepted_status_codes = ["200-299"]
|
accepted_status_codes = ["200-299"]
|
||||||
|
@ -167,11 +173,18 @@ def _build_monitor_data(
|
||||||
return 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 = {
|
data = {
|
||||||
"name": name,
|
"name": name,
|
||||||
"type_": type_,
|
"type_": type_,
|
||||||
"default": default,
|
"default": default,
|
||||||
|
"apply_existing": apply_existing,
|
||||||
**kwargs
|
**kwargs
|
||||||
}
|
}
|
||||||
data = convert_to_socket(params_map_notification_and_provider, data)
|
data = convert_to_socket(params_map_notification_and_provider, data)
|
||||||
|
@ -214,7 +227,7 @@ def _build_status_page_data(
|
||||||
theme: str = "light",
|
theme: str = "light",
|
||||||
published: bool = True,
|
published: bool = True,
|
||||||
show_tags: bool = False,
|
show_tags: bool = False,
|
||||||
domain_name_list: list[str] = None,
|
domain_name_list: list = None,
|
||||||
custom_css: str = "",
|
custom_css: str = "",
|
||||||
footer_text: str = None,
|
footer_text: str = None,
|
||||||
show_powered_by: bool = True,
|
show_powered_by: bool = True,
|
||||||
|
@ -366,7 +379,7 @@ class UptimeKumaApi(object):
|
||||||
def __init__(self, url):
|
def __init__(self, url):
|
||||||
self.sio = socketio.Client()
|
self.sio = socketio.Client()
|
||||||
|
|
||||||
self._event_data: dict[str, any] = {
|
self._event_data = {
|
||||||
"monitorList": None,
|
"monitorList": None,
|
||||||
"notificationList": None,
|
"notificationList": None,
|
||||||
"proxyList": None,
|
"proxyList": None,
|
||||||
|
@ -780,7 +793,7 @@ class UptimeKumaApi(object):
|
||||||
steam_api_key: str = "",
|
steam_api_key: str = "",
|
||||||
|
|
||||||
# notifications
|
# notifications
|
||||||
tls_expiry_notify_days: list[int] = None,
|
tls_expiry_notify_days: list = None,
|
||||||
|
|
||||||
# security
|
# security
|
||||||
disable_auth: bool = False
|
disable_auth: bool = False
|
||||||
|
|
|
@ -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:
|
if type(params) == list:
|
||||||
out = []
|
out = []
|
||||||
params_list = params
|
params_list = params
|
||||||
|
|
Loading…
Reference in a new issue