async-healthcheck
async-healthcheck is a compact asynchronous health check library built using only the Python standard library. It provides a simple way to monitor the health of your application by checking the status of various synchronous and asynchronous functions.
Installation
You can install async-healthcheck directly from PyPI:
pip install async-healthcheck
Usage
Here is a basic usage example:
from async_healthcheck import start_healthcheck
def sync_check():
# Perform some synchronous health check (e.g., check database connection)
return True
async def async_check():
# Perform some asynchronous health check (e.g., check API availability)
return True
async def main():
server = await start_healthcheck(
sync_callables=[sync_check],
async_callables=[async_check],
host="127.0.0.1",
path="/healthcheck",
port=8000,
)
# The server is now running and can be accessed at http://127.0.0.1:8000/healthcheck
if __name__ == "__main__":
import asyncio
asyncio.run(main())
In this example, start_healthcheck starts a health check server that runs the provided synchronous and asynchronous checks when a GET request is made to the specified path (default is /healthcheck). If all checks pass, it returns a 200 status code; if any check fails, it returns a 500 status code.
Testing
Tests are located in the tests directory and can be run using the standard Python unittest module:
PYTHONPATH="async_healthcheck" poetry run python -m unittest discover -s tests
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Metadata
Release files for async-healthcheck 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| async_healthcheck-0.7.0.tar.gz | 6.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| async_healthcheck-0.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.8 kB
Release files / async_healthcheck-0.7.0.tar.gz
| Download URL | async_healthcheck-0.7.0.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7448a5a0731001352f2530b919fa922a7246c3bc093d3d4847d34f79569c562e
|
|
BLAKE2b-256 checksum How to use checksums |
4193cb113cb293c97645a4f68cd51efb3d44375fdbb26c6e06a237bce397265f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.9.19 Linux/6.5.0-1016-azure
|
Release files / async_healthcheck-0.7.0-py3-none-any.whl
| Download URL | async_healthcheck-0.7.0-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ddb3610834b26ab86c7a7fcd63035f42f2734da339513b3b90bd7471eb172f21
|
|
BLAKE2b-256 checksum How to use checksums |
76fc1ac2dbfa9239f6048f18b9ba0e952b73a59aeaa7220fc9a8c3d52183292e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.9.19 Linux/6.5.0-1016-azure
|
Security for async-healthcheck 0.7.0
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.