Simple way to make a /status for your services with python and asyncio.
Project description
Status
Simple way to make a /status for your services with python and asyncio.
Install
pip install api-status
How it works ?
TL;DR;
Check a working example at: https://gitlab.com/cdlr75/status/-/blob/develop/tests/learning/example.py
Let say you have a coroutine that replies a dict with the desired status of your service:
async def status():
""" Returns our service status.
:returns: Misc info about our service.
:rtype: dict
"""
return {
"name": "MyService",
"status": "ok",
"version": "v1"
}
With api-status, to expose this through an HTTP endpoint:
from status import Server
server = Server(host="127.0.0.1", port=8080)
# register our status endpoint
server.add_route(status, method="GET", path=r"/status")
await server.start()
# the status is now available at http://127.0.0.1:8080/status
If you take care of graceful shutdowns for your services, call the method stop
:
await server.stop()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
api-status-1.0.1.tar.gz
(10.5 kB
view details)
Built Distribution
File details
Details for the file api-status-1.0.1.tar.gz
.
File metadata
- Download URL: api-status-1.0.1.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 821e69adb3156e4b9b8562ed0b183121327a4653bc42083bd9ce8e0b05637489 |
|
MD5 | 0385c7dc0fabd7bf6c7437537e383148 |
|
BLAKE2b-256 | f93b87a5c524a4fd6d33066588a843971cba9a56cf354252e709aebbca051acd |
File details
Details for the file api_status-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: api_status-1.0.1-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54e8a47251dcdb90e2685cfa0be31015adc9a72e96affaf9d6d05c5b1fd340b6 |
|
MD5 | f67ac03fcf1b1ba61282207cb543dc64 |
|
BLAKE2b-256 | 832f6e2afaa97ead3170e38e56209caf24bee97f0f6a4e819edc569e2ced83d3 |