Wrapper around Flask aimed at conveniently creating microservices
Project description
OneService
Wrapper around Flask aimed at conveniently creating microservices.
Features and limitations:
Microservicecreates a server that can call a handler method when/is hit (HTTP method is configurable)- The handler method receives the request JSON data and must respond with a
(dict, int)tuple containing the response data and response status code
Usage
from oneservice import Microservice
def return_doubled(json_data: dict) -> (dict, int):
return {"result": int(json_data["a"]) * 2}, 200
m = Microservice(handler=return_doubled)
m.start()
You may then hit the microservice and its health endpoint:
curl http://localhost:5000/health
curl -X POST -H "Content-Type: application/json" --data '{"a": 2}' http://localhost:5000/
See /examples for more code usage samples.
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
oneservice-1.0.0.tar.gz
(3.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file oneservice-1.0.0.tar.gz.
File metadata
- Download URL: oneservice-1.0.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.8.2 Linux/4.19.78-coreos
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92496c568f6f252f76b5793b60065edfc36b2114d1de08315868041dbc0616f6
|
|
| MD5 |
322896de20ec8d0766c475ae48fd766b
|
|
| BLAKE2b-256 |
72a5bda652df7ebb6e69cc3c099c232b07a5a5e95bb18880fd54ef10bbeebd25
|
File details
Details for the file oneservice-1.0.0-py3-none-any.whl.
File metadata
- Download URL: oneservice-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.8.2 Linux/4.19.78-coreos
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ac9fbb499fd823676bbea75455d1bb94830eb2abfa4f752ca5c1c9dc6aadb8e
|
|
| MD5 |
2777dbd1f5564a19f49822813c252459
|
|
| BLAKE2b-256 |
98ff37340c7223337f7b03d81ed811021a1cf2fe60057a79686231572ec90581
|