Skip to main content

Rinzler REST Framework

Django-based REST Micro-Framework

Install requires

pip install rinzler

Usage

# urls.py
from rinzler import boot, Rinzler

from rinzler.core.main_controller import MainController
from your_controller import Controller


app: Rinzler = boot("MyApp")

urlpatterns = [
    app.mount('hello', Controller),
    app.mount('', MainController),
]
# your_controller.py
from django.http.request import HttpRequest

from rinzler import Rinzler
from rinzler.core.response import Response


class Controller:

    def connect(self, app):

        router = app.get_end_point_register()

        # map end-points to callbacks here
        router.get('/world/', self.hello_world)
        router.get('/{name}/', self.hello_user)

        return router

    # end-point callbacks here:
    @staticmethod
    def hello_world(request: HttpRequest, app: Rinzler, **params: dict):
        """
        Default route callback
        :param request HttpRequest
        :param app Rinzler's object
        :param params dict url params, if present
        :rtype: Response
        """
        try:
            response = {
                "status": True,
                "data": "Hello World!",
            }
            return Response(response, content_type="application/json")
        except BaseException as e:
            response = {
                "status": False,
                "mensagem": str(e),
            }
            return Response(response, content_type="application/json", status=500)\

    @staticmethod
    def hello_user(request: HttpRequest, app: Rinzler, **params: dict) -> Response:
        try:
            user = params['name']
            response = {
                "status": True,
                "data": f"Hello {user}!",
            }

            return Response(response, content_type="application/json")
        except BaseException as e:
            response = {
                "status": False,
                "mensagem": str(e),
            }
            return Response(response, content_type="application/json", status=500)

Run django

python manage.py runserver
August 02, 2017 - 18:48:00
Django version 1.10.4, using settings 'Demo.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

Sample requests

curl http://localhost:8000/
<center><h1>HTTP/1.1 200 OK RINZLER FRAMEWORK</h1></center>

curl http://localhost:8000/hello/world/
{
  "status": true,
  "data": "Hello World!"
}

curl http://localhost:8000/hello/bob/
{
  "status": true,
  "data": "Hello bob!"
}

curl http://localhost:8000/foo/bar/
{
  "status": false,
  "exceptions": {
    "message": "No route found for GET foo/bar/"
  },
  "request": {
    "content": "",
    "method": "GET",
    "path_info": "foo/bar/"
  },
  "message": "We are sorry, but something went terribly wrong."
}
# If project's settings has DEBUG=True, otherwise: empty response body with status-code 404

Authentication

Authentication can be done on a per-route basis thus allowing to have authenticated and non-authenticated routes on the application.

To do so, first you need to create a class that inherits from BaseAuthService and implements the authenticate method.

from django.http.request import HttpRequest

from rinzler.auth.base_auth_service import BaseAuthService

class MyAuthenticationService(BaseAuthService):
    def authenticate(self, request: HttpRequest, auth_route: str, params: dict) -> bool:
        """
        Implement your authentication logic here
        :param request: HttpRequest Django's request object
        :param auth_route: str route being requested
        :param params: dict url params, if present
        :return: bool if not True, the request will be promptly returned with status-code 403
        """
        # Non-authenticated route
        if auth_route == 'GET_v1/hello/world/':
            return True

        # Authenticated routes
        if request.META.get("HTTP_AUTHORIZATION"):
            # after performing your authentication logic, you can append user data to the Rinzler object so it'll be available on the controller
            self.auth_data = {
                "user_id": 1,
            }
            return True

Then, you need to register your authentication service on the application's urls.py file.

# urls.py
from rinzler import boot, Rinzler

from rinzler.core.main_controller import MainController
from your_controller import Controller
from my_auth_service import MyAuthenticationService


app: Rinzler = boot("MyApp")
app.set_auth_service(MyAuthenticationService())

urlpatterns = [
    app.mount('hello', Controller),
    app.mount('', MainController),
]

Finally, you can access the user data on the controller by accessing the auth_data attribute on the Rinzler object.

# your_controller.py
from django.http.request import HttpRequest

from rinzler import Rinzler
from rinzler.core.response import Response


class Controller:
    # ...
    @staticmethod
    def hello_user(request: HttpRequest, app: Rinzler, **params: dict) -> Response:
        try:
            user = params['name']
            user_id = app.auth_data['user_id']
            response = {
                "status": True,
                "data": f"Hello {user}! Your user id is {user_id}.",
            }

            return Response(response, content_type="application/json")
        except BaseException as e:
            response = {
                "status": False,
                "mensagem": str(e),
            }
            return Response(response, content_type="application/json", status=500)

Sample requests

# Non-authenticated request
curl http://localhost:8000/hello/world/
{
  "status": true,
  "data": "Hello World!"
}

# Improperly authenticated request
curl http://localhost:8000/hello/bob/
# (empty response body with status-code 403)

# Properly authenticated request
curl http://localhost:8000/hello/bob/ -H "Authorization: XYZ"
{
  "status": true,
  "data": "Hello bob! Your user id is 1"
}

Metadata

Release files for rinzler 3.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rinzler 3.2.0
File Size Uploaded Provenance Actions
rinzler-3.2.0.tar.gz 25.0 kB With provenance Details for rinzler-3.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rinzler 3.2.0
File Interpreter ABI Platform Actions
rinzler-3.2.0-py3-none-any.whl Python 3 none any Details for rinzler-3.2.0-py3-none-any.whl

Total release size: 46.4 kB

Release files / rinzler-3.2.0.tar.gz

Download URL rinzler-3.2.0.tar.gz
Size 25.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b600de72dd39f537c37c8005627ddd50d7df2f9f2de529d2835ce0acbaefa242
BLAKE2b-256 checksum
How to use checksums
95d35cd098d9f644ae01d395be86eaf9e699f60745ec146cf4912b77e2c80959
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 17, 2026.

Transparency log

Release files / rinzler-3.2.0-py3-none-any.whl

Download URL rinzler-3.2.0-py3-none-any.whl
Size 21.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
945242072fd502eb458fe31d860c1a7c99221e7fb04519746cab0b1295c1d5f2
BLAKE2b-256 checksum
How to use checksums
4b2e150bfbe300623ca9f950d20708e09305406a6c16d3173a94c9ae3b26b3b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 17, 2026.

Transparency log

Security for rinzler 3.2.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rinzler-3.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 17, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

3.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page