Helper layer for apis development with Python and Flask
Project description
ZPy Flask Core, Layer for build microservices
ZPy Flask Core
Zurck'z Py Flask Micro Services Core
This package contains some helpers features for build python microservices using Flask framework
ZPy use the following packages:
- Flask
- marshmallow
Requirements
- Python 3.6+
Installation
Use the package manager pip to install py flask micro service core .
pip install boto3
pip install zpy
Features
Contains some helper features with specific integrations.
- Api
- Api Builder
- Response Builder
- Models
- Hooks
- Middlewares
- Exceptions
- Repositories
- Only oracle repository implementation for functions calling.
- Cloud Implementations
- AWS Services
- S3
- SSM
- Firehose
- SQS
- AWS Services
- Custom
- Plugings
- Database
- Only Oracle implementation
- Functions executor
- Only Oracle implementation
- Logger
- Stream
- Utils
- Collections
- Cipher
- Functions
- gzip
Basic Usage
Define restful resource
from zpy.api.resource import ZResource, HTTP_METHODS
class UserResource(ZResource):
def __init__(self, **kwargs) -> None:
super().__init__()
# Receive any dependency by keywords arguments
def get(self):
l, i = super().new_operation()
try:
return self.success({"user": {"name":"Zurckz"}}, logger=l)
except Exception as e:
return self.handle_exceptions(e, l, i)
Setup api
#Define api
@api(base='/v1', config=config)
def create_api():
#Set all supported resource for this web service.
return \
[
ZResource('/', UserResource)
]
Local Dev Deploy
from api import create_api
app = create_api()
# 🚨 Only use it in local tests 💻
if __name__ == "__main__":
app.run(host="localhost", debug=True)
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
Authors
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
zpy-api-core-0.0.1.tar.gz
(12.1 kB
view hashes)
Built Distribution
Close
Hashes for zpy_api_core-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1ac17e8afd2ff9fe3b0b8dca30d54f737c7695faff4b49bca3688e9c9639ca0 |
|
MD5 | 61f4cc740db2645dea0667c7a456977a |
|
BLAKE2b-256 | bccbe85481999a8df64819c017eb68eeac2c240fb7b595b29b91d039d11aa2a3 |