Metadata-Version: 2.1
Name: api-status
Version: 1.0.0
Summary: Simple way to make a /status for your services with python and asyncio.
Home-page: https://gitlab.com/pypa/sampleproject
Author: cdlr75
Author-email: cdlr75@gmail.com
License: UNKNOWN
Project-URL: Bug Reports, https://gitlab.com/cdlr75/status/issues
Project-URL: Source, https://gitlab.com/cdlr75/status/
Keywords: api status service
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: aiohttp (>=3.5)
Provides-Extra: doc
Requires-Dist: sphinx ; extra == 'doc'
Requires-Dist: recommonmark ; extra == 'doc'
Requires-Dist: changelogfromtags ; extra == 'doc'
Provides-Extra: test
Requires-Dist: pytest ; extra == 'test'
Requires-Dist: pytest-cov ; extra == 'test'
Requires-Dist: asynctest ; extra == 'test'
Requires-Dist: pycodestyle ; extra == 'test'
Requires-Dist: pylint ; extra == 'test'

# Status
[![PEP8](https://img.shields.io/badge/code%20style-pep8-green.svg)](https://www.python.org/dev/peps/pep-0008/)
[![coverage report](https://gitlab.com/cdlr75/status/badges/master/coverage.svg)](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 `status`, to expose this throught 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 gracefull shutdowns for your services, call the method `stop`:
```py
await server.stop()
```


