Simple, efficient, intuitive API Framework
Project description
This is sample template to create a quick Python Falcon API application. It uses a schema defined in the resource for the route path and OpenAPI documentation. The base application will handle creating the routes and documentation automatically at runtime.
You define a resource and the documentation will be auto-generated at startup using the docstrings.
from reliqua.resources.base import Resource
from reliqua import status_codes as status
class User(Resource):
__routes__ = [
'/users/{id}',
]
phone = phone
def on_get(self, req, resp, id=None):
"""
Retrieve a user. This value
is awesome
:param str id: [in=path, required] User ID
:param str email: [in=query] User Email
:param str phone: [in=query enum] Phone Numbers
:response 200:
:response 400:
:return json:
"""
try:
resp.media = users[int(id)]
except IndexError:
resp.status = status.HTTP_404
def on_delete(self, req, resp, id=None):
try:
users.pop(int(id))
resp.media = {'success': True}
except IndexError
resp.status = status.HTTP_400
This will create the /users/{id} endpoint and corresponding API documentation. The OpenAPI documentation and swagger.json will be dynamically generate at application startup. The OpenAPI ui will be available at:
http://<api-url>/docs/
and the swagger.json file located at:
http://<api-url>/docs/swagger.json
To create an application, you import the application template.
from reliqua.app import Application
app = Application(
bind='0.0.0.0:8000',
ui_url = 'http://example.com/api',
workers=1,
resource_path='/var/www/html/resources'
)
app.run()
Where:
bind: Address and port to listen for requests. [host:port]
ui_url: The URL to the API when being used with a proxy, like nginx. If not supplied,
then the bind address is used.
workers: Number of worker threads to start.
resource_path: This is where your python resource files are located.
Refer to the example application for more examples. You can install the library and example application
python setup.py install
You can execute the example application
$ reliqua-example
From here the openapi-ui will be available at
http://localhost:8000/docs/
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
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 reliqua-0.0.13.tar.gz.
File metadata
- Download URL: reliqua-0.0.13.tar.gz
- Upload date:
- Size: 1.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6b0441f60d85d4ab2fa48d2cb732dbb6901ce4e2017207d58e51bdf52127bc6
|
|
| MD5 |
e71d727686d5f314091b290049e955c9
|
|
| BLAKE2b-256 |
06a098f28f3d3c0f2a4bad0110cdb5262372b3eeffb75f713d425cf3442928aa
|
Provenance
The following attestation bundles were made for reliqua-0.0.13.tar.gz:
Publisher:
publish-pypi.yml on tmeiczin/reliqua
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
reliqua-0.0.13.tar.gz -
Subject digest:
c6b0441f60d85d4ab2fa48d2cb732dbb6901ce4e2017207d58e51bdf52127bc6 - Sigstore transparency entry: 611007413
- Sigstore integration time:
-
Permalink:
tmeiczin/reliqua@9547122759f4fa05ea794d61dbb8c6fd9cb2e9d1 -
Branch / Tag:
refs/tags/0.0.13 - Owner: https://github.com/tmeiczin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@9547122759f4fa05ea794d61dbb8c6fd9cb2e9d1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file reliqua-0.0.13-py3-none-any.whl.
File metadata
- Download URL: reliqua-0.0.13-py3-none-any.whl
- Upload date:
- Size: 1.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af11869298cc62eef20c48fa8d73fae0c34b628bd5f8adea21c9c9bf1ffe5615
|
|
| MD5 |
6458074ebdac7bcb187e8ee1cda90380
|
|
| BLAKE2b-256 |
a9dcb3b404b80278c6b94597432a53a8eb5b64ee06a4f653e87befd1f6f042c2
|
Provenance
The following attestation bundles were made for reliqua-0.0.13-py3-none-any.whl:
Publisher:
publish-pypi.yml on tmeiczin/reliqua
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
reliqua-0.0.13-py3-none-any.whl -
Subject digest:
af11869298cc62eef20c48fa8d73fae0c34b628bd5f8adea21c9c9bf1ffe5615 - Sigstore transparency entry: 611007430
- Sigstore integration time:
-
Permalink:
tmeiczin/reliqua@9547122759f4fa05ea794d61dbb8c6fd9cb2e9d1 -
Branch / Tag:
refs/tags/0.0.13 - Owner: https://github.com/tmeiczin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@9547122759f4fa05ea794d61dbb8c6fd9cb2e9d1 -
Trigger Event:
release
-
Statement type: