Skip to main content

Python Lightweight Framework

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Dorton-0.0.1.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Dorton-0.0.1.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file Dorton-0.0.1.1.tar.gz.

File metadata

  • Download URL: Dorton-0.0.1.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for Dorton-0.0.1.1.tar.gz
Algorithm Hash digest
SHA256 84c967f2967ff843e87ef5414fb6ff50489311c27d68bb83eb5a95a84d3c2134
MD5 724567a1ca6e57a953d37464e3c6ebe3
BLAKE2b-256 3c0908bc51aaeba996794950a295e07db8aa3b9b9586a49613761e61843db345

See more details on using hashes here.

File details

Details for the file Dorton-0.0.1.1-py3-none-any.whl.

File metadata

  • Download URL: Dorton-0.0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for Dorton-0.0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f2124a6fb970d098be7f2105c74829d177c05c28903e1af7bbd338eeb9a106db
MD5 c9372a2a09bc1cad7d5f0fecbbfea345
BLAKE2b-256 e48e614381c272f9a7fe4620af95f85c4831a0ecd5a5f84d81404c2f8fc00b81

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page