INNER CODE UNIT · Python

notify

ahembree/ansible-hms-docker · roles/hmsdocker/files/scripts/monitoring/check_media_availability.py:43

def notify(status: str, message: str, ping: int = 0) -> int:
    """Sends a GET request to the Uptime Kuma host

    Args:
        ``status`` (``str``): The status of ``up`` or ``down``
        
        ``message`` (``str``): The message to send
        
        ``ping`` (``int``, optional): Value to send for 'ping'. Defaults to 0.

    Returns:
        ``int``: the HTTP status code
    """    
    logging.info(f'Sending notification:\n\tstatus: {status}\n\tmessage: {message}\n\tping: {ping}')
    push_notify = requests.get(f'{KUMA_URL}?status={status}&msg={message}&ping={ping}', verify=False)
    status_code = push_notify.status_code
    logging.debug(f'Sent notification, got status code: {status_code}')
    return status_code

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…