Skip to main content

HealthPing

Table of Contents

Introduction

HealthPing is a lightweight python package that allows users to easily include liveness monitoring in their applications. If you've got a python program running (such as a telegram bot) and find yourself wondering from time to time about its liveness, then this is the package for you! HealthPing abstracts away the task of sending request to monitoring endpoints, managing timezones and retries - offering all these in as short as two lines of code:

from health_ping import HealthPing
HealthPing(url="https://hc-ping.com/<id>", timezone="UTC+08:00", schedule="1 * * * *").start()

HealthPing essentially adopts the "deadman switch" approach, where it regularly sends a "heartbeat" to a monitoring service such as Healthchecks.io. If a "heartbeat" does not arrive within a scheduled period, the service is assumed dead and an alert (e.g. email notification) is then sent out to the service owner.

HealthPing is published on pypi and can be easily installed with:

python3 -m pip install health_ping

Details on the usage of the package can be found on the wiki page.

Features

As a lightweight utility package, HealthPing serves to carry out a single yet important purpose - notify the monitoring service that your application is still healthy and running. In order to assist you with that, HealthPing comes equipped with the following parameters for configuration:

  • url
  • method
  • headers
  • body
  • timezone
  • schedule
  • retries
  • pre_fire
  • post_fire
  • log_file
  • debug

For most of the use cases, specifying the url, timezone and schedule will be enough! Details on each parameter such as their default values and usage are described in the wiki page.

Technologies

Technologies used by HealthPing are as below:

Done with:

Python

Project Repository
https://github.com/tjtanjin/health_ping

Setup

This section will walk you through setting up a development environment if you wish to make modifications or contributions to the project.

  1. First, cd to the directory of where you wish to store the project and clone this repository. An example is provided below:
    cd /home/user/exampleuser/projects/
    git clone https://github.com/tjtanjin/health_ping.git
    
  2. Once the project has been cloned, cd into it and install required dependencies with the following command:
    python3 -m pip install --no-cache-dir -r requirements.txt requirements-dev.txt
    
  3. Following which, create (or copy) a .env file at the root of the project using the provided .env.template. In order to run tests, you need to replace the TEST_URL variable within the .env file with any valid URL of your choice.
  4. Proceed to make changes to the project (you may also wish to add test cases if necessary) and when ready, run tests with:
    python3 -m pytest ./tests/test.py
    
  5. Should you wish to build this into a package, you may run the following commands within the project root directory:
    python3 -m build
    

Team

Note: Special thanks to Avery Khoo for bouncing ideas and sharing knowledge!

Contributing

If you have code to contribute to the project, open a pull request and describe clearly the changes and what they are intended to do (enhancement, bug fixes etc).

Alternatively, you may contact me via discord or simply raise bugs or suggestions by opening an issue.

Others

For any questions regarding the implementation of the project, you may also reach out on discord or drop an email to: cjtanjin@gmail.com.

Metadata

Release files for health-ping 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for health-ping 1.0.1
File Size Uploaded Provenance Actions
health_ping-1.0.1.tar.gz 6.7 kB Without provenance Details for health_ping-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for health-ping 1.0.1
File Interpreter ABI Platform Actions
health_ping-1.0.1-py3-none-any.whl Python 3 none any Details for health_ping-1.0.1-py3-none-any.whl

Total release size: 14.1 kB

Release files / health_ping-1.0.1.tar.gz

Download URL health_ping-1.0.1.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
33d780896591a090bfcaf05b89d054f2814a89bd39c32bf34ac792655e04fef8
BLAKE2b-256 checksum
How to use checksums
c40f323797af305b656414cc845904642d5b7379da65c7cc9940c6860564e890
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Release files / health_ping-1.0.1-py3-none-any.whl

Download URL health_ping-1.0.1-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac1367aec12f1c50266717516a66796624e5e12cacbe5f944109f523bc0cfc88
BLAKE2b-256 checksum
How to use checksums
786425c112d831270139906b859ba349c4b89e64b67c1f9b2984cb8affce1ec7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Security for health-ping 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page