Skip to main content

REST microservice framework based on Flask, OpenAPI, gunicorn and celery, deployable towards GKE and Beanstalk

Project description

pymacaron logo


Python microservice framework based on Flask, OpenAPI, gunicorn and celery, deployable on GKE and Beanstalk

PyMacaron's documentation is available at

This page dives deeper into internal implementation details.

Deep dive

Built-in endpoints

The following endpoints are built-in into every pymacaron instance, based on this swagger spec:

# Assuming you did in a separate terminal:
# $ python --port 8080

$ curl

$ curl
  "container": "",
  "name": "ping",
  "version": "0.0.1"

$ curl
  "error_description": "There is no Authorization header in the HTTP request",
  "error_id": "17f900c8-b456-4a64-8b2b-83c7d36353f6",
  "status": 401,

$ curl -H "Authorization: Bearer eyJpc3M[...]y8kNg"
  "container": "",
  "name": "ping",
  "version": "0.0.1"

Loading api clients from a standalone script

It may come very handy within a standalone script to be able to call REST apis through the pymacaron framework, to get object marshalling and error handling out of the box. It is done as follows:

import flask
from pymacaron_core.swagger.apipool import ApiPool
from pymacaron.exceptions import is_error
from pymacaron import load_clients

# Declare a Flask app and mock its context
app = flask.Flask(__name__)
with app.test_request_context(''):

    # Then load client libraries against a given set of libraries
    api = API(app)
    api.load_clients(apis=['login', 'search'])

    # And you can now call those apis seamlessly!
    result = ApiPool.login.client.do_login(

    if is_error(result):
        log.error("Oops. Failed to login user")


Erwan Lemonnier

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.

Files for pymacaron, version 1.0.255
Filename, size File type Python version Upload date Hashes
Filename, size pymacaron-1.0.255.tar.gz (32.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page