Skip to main content

API Health Checks

Project description

API Health Checks

pypi version Build status Coverage Code style: black Number of tests Number of downloads

Health checks are based on Health Check RFC draft version 3.


requests module must be installed to perform HTTP health checks.

import healthpy.http

status, details = healthpy.http.check("service name", "http://service_url")


redis module must be installed to perform Redis health checks.

import healthpy.redis

status, details = healthpy.redis.check("redis://redis_url", "redis_key")

Compute status from multiple statuses

import healthpy

status1 = healthpy.pass_status 
status2 = healthpy.warn_status
statusN = healthpy.fail_status

status = healthpy.status(status1, status2, statusN)

Using custom status

By default pass status is "pass", warn status is "warn" and fail status is "fail".

It can be tweaked by setting the value of healthpy.*_status as in the following sample:

import healthpy

healthpy.pass_status = "ok"
healthpy.warn_status = "custom"
healthpy.fail_status = "error"


A pytest fixture can be used to mock the datetime returned in http health check.

from healthpy.testing import mock_http_health_datetime

def test_http(mock_http_health_datetime):
    pass  # Add your test calling healthpy.http.check

How to install

  1. python 3.6+ must be installed
  2. Use pip to install module:
python -m pip install healthpy

Project details

Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for healthpy, version 1.7.0
Filename, size File type Python version Upload date Hashes
Filename, size healthpy-1.7.0-py3-none-any.whl (6.2 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size healthpy-1.7.0.tar.gz (4.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page