aubergine is a library that helps you effortlessly create REST API using API-first approach.
Creating an API in aubergine is simple and requires only the following steps:
Create your OpenAPI 3 specification file, with operationId set to the callable of your choice.
openapi: "3.0.0"
servers:
- url: /v1/rest
info:
version: 1.0.0
title: Hello World
description: My first api.
paths:
/hello:
get:
operationId: hello_world.hello
parameters:
- who: who
in: query
description: who to great
required: true
schema:
type: string
responses:
'200':
description: Greeting dedicated to given name.
content:
application/json:
schema:
$ref: '#/components/schemas/Greeting'
components:
schemas:
Greeting:
required:
- message
properties:
message:
type: string
Implement operations that you declared in your specification. Place hello_world module with the following content in an importable directory.
def hello(who):
"""Handles v1/rest/hello"""
return {'message': 'Hello {}!'.format(who)}
Tell aubergine to create an app for you. Create a hello_app.py with the following contents:
from aubergine import Aubergine
app = Aubergine.from_file('hello_world.yml')
api = app.build_api()
Your app is ready to go. You can run it with any WSGI server like so:
gunicorn hello_app:api
Test it by navigating to http://localhost:8000/v1/rest/hello?who=World
Metadata
Release files for aubergine 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| aubergine-0.1.2.tar.gz | 18.4 kB | Without provenance | Details |
Release files / aubergine-0.1.2.tar.gz
| Download URL | aubergine-0.1.2.tar.gz |
|---|---|
| Size | 18.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea9a6dceb85c26da1131c5022dfa98eed07eef9a8e6392af550b6277ba600ce3
|
|
BLAKE2b-256 checksum How to use checksums |
4e1bcf6d7634cd5e642eac96bca4876ee9ad0353035c75620acda148fc2cc826
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for aubergine 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.