/pykuma

An API for Python Scripts to integrate with Uptime Kuma

Primary LanguagePythonMIT LicenseMIT

PyKuma

An API for Python Scripts to integrate with Uptime Kuma.

PyPI GitHub watchers GitHub forks GitHub Repo stars

Interested in donating? A donate link will be here soon :)

Installation

PyPI/pip - Easiest method

The easiest way to install PyKuma is using PyPI. Simply type:

pip install pykuma

or, if python isn't in your PATH:

py -m pip install pykuma

View on PyPI

Including the script

  1. The second way to install PyKuma is using the script directly.
  2. You can do this by downloading the latest version of the script here
  3. Place it in the same directory as your script. Once you've done so, rename it to 'pykuma.py'.

Usage

First, import PyKuma into your project:

import pykuma
# -- or, use an alias --
import pykuma as pyk

Secondly, we need to configure it with Uptime Kuma. To do this, open your Uptime Kuma dashboard and create a new Push monitor. Copy the Push URL given.

Now, back at the script, type:

pykuma.configure(url="uptime-kuma-push-url", heartbeat=60, ShowMessage=True, printPush=False)

the arguements mean the following:

  • url - the push URL from Uptime Kuma. Required.
  • heartbeat - the heartbeat interval to push to kuma in. Optional - if not specified, 60
  • ShowMessage - whether to show PyKuma credit message. Optional - if not specified, true
  • printPush - print when pushed. Optional - if not specified, false

Finally, type:

pykuma.start()

PyKuma will begin periodically pushing every heartbeat interval. If you check your monitor, you should see one push already come through as PyKuma runs one for testing.

Demo output and code usage

You can view the demo output and code usage in this Workflow run.

Naviating to demo output

  1. Click on the demo you'd like to view. For example, 'printing on push'.
  2. You should see the demo output.

image

Navigating to code usage

  1. Click on the demo you'd like to view. For example, 'printing on push'.
  2. Click the following arrow.

image

  1. You should see the demonstration code.

image

Dependencies used