Skip to main content

A Python lightweight and fast framework for REST APIs

To get started: pip install dorton

With function based handlers

from dorton.app import App

app = App()

@app.route("/home")
def home(request):
    return {"ok": True}

Use gunicorn to get the server started with the command: gunicorn init:app --bind=127.0.0.1:8000 --reload

You can also return a custom response or pass a parameter to the url

app = App()

class CustomResponse:
    def __init__(self, name) -> None:
        self.name = name

@app.get("/get/{name}")
def get_name(request, name):
    return CustomResponse(name)

You can use a class based handlers:

from dorton.app import App
from dorton.http.response import APIResponse
from dorton.http.enums import HttpStatusCode

app = App()

@app.route("/class-based")
class ClassBasedController:
    def get(self, request):
        return APIResponse(content={"ok": "get worked"}, status_code=HttpStatusCode.ACCEPTED)

    def post(self, request):
        return APIResponse(content={"ok": "post worked"}, status_code=HttpStatusCode.OK)

Metadata

Release files for Dorton 0.0.1.1

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

Source distribution (sdist)

Source distribution for Dorton 0.0.1.1
File Size Uploaded
Dorton-0.0.1.1.tar.gz 3.7 kB Details

Built distribution (wheel)

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

Total release size: 8.2 kB

Release files / Dorton-0.0.1.1.tar.gz

Download URL Dorton-0.0.1.1.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
84c967f2967ff843e87ef5414fb6ff50489311c27d68bb83eb5a95a84d3c2134
BLAKE2b-256 checksum
How to use checksums
3c0908bc51aaeba996794950a295e07db8aa3b9b9586a49613761e61843db345
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6

Release files / Dorton-0.0.1.1-py3-none-any.whl

Download URL Dorton-0.0.1.1-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f2124a6fb970d098be7f2105c74829d177c05c28903e1af7bbd338eeb9a106db
BLAKE2b-256 checksum
How to use checksums
e48e614381c272f9a7fe4620af95f85c4831a0ecd5a5f84d81404c2f8fc00b81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.0.1.1 This release

2 release files

0.0.1

2 release files

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