api-status-1.0.1
توضیحات
Simple way to make a /status for your services with python and asyncio.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | api-status-1.0.1 |
| نام | api-status |
| نسخه کتابخانه | 1.0.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | cdlr75 |
| ایمیل نویسنده | cdlr75@gmail.com |
| آدرس صفحه اصلی | https://gitlab.com/pypa/sampleproject |
| آدرس اینترنتی | https://pypi.org/project/api-status/ |
| مجوز | - |
# Status
[](https://www.python.org/dev/peps/pep-0008/)
[](https://gitlab.com/cdlr75/status/-/commits/master)
Simple way to make a /status for your services with python and asyncio.
## Install
```sh
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:
```py
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:
```py
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`:
```py
await server.stop()
```
نیازمندی
| مقدار | نام |
|---|---|
| >=3.5 | aiohttp |
| - | sphinx |
| - | recommonmark |
| - | changelogfromtags |
| - | pytest |
| - | pytest-cov |
| - | asynctest |
| - | pycodestyle |
| - | pylint |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl api-status-1.0.1:
pip install api-status-1.0.1.whl
نصب پکیج tar.gz api-status-1.0.1:
pip install api-status-1.0.1.tar.gz