Skip to main content

Helper layer for apis development with Python and Flask

Project description

Zurck'z

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
  • Custom
    • Plugings
  • Database
    • Only Oracle implementation
      • Functions executor
  • 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

MIT

Authors

Noé Cruz

Project details


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.3.tar.gz (25.6 kB view hashes)

Uploaded Source

Built Distribution

zpy_api_core-0.0.3-py3-none-any.whl (31.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page