Skip to main content

async REST framework

Project description

Kame

Async REST framework for tortoise-orm and starlette

Requirements

Installation

pip install kame

Usage

Having the following tortoise model:

from tortoise.models import Model
from tortoise import fields

class Tour(Model):
    id = fields.IntField(pk=True)
    name = fields.TextField()
    data = fields.JSONField(default=dict)

    def __str__(self):
        return self.name
  1. Create a serializer
from kame import serializers

class TourSerializer(serializers.ModelSerializer):

    class Meta:
        model = Tour
        fields = ['id', 'name', 'description', 'parent', 'active', 'image', 'descendant_ids']
  1. Create a viewset
from kame import viewsets

class TourViewSet(viewsets.ModelViewSet):
    queryset = Tour.all
    serializer_class = TourSerializer
  1. Register a route
from kame import routers

router = routers.DefaultRouter()

router.register('/tours', TourViewSet, basename="tour")

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

kame-0.0.2.tar.gz (4.6 kB view details)

Uploaded Source

File details

Details for the file kame-0.0.2.tar.gz.

File metadata

  • Download URL: kame-0.0.2.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/2.7.16

File hashes

Hashes for kame-0.0.2.tar.gz
Algorithm Hash digest
SHA256 735cdc3a9f2462e2645f7085ff536bc3665817b6d2c2f1bdfff5d4994807822a
MD5 c82d9fcb062027b04b9cdec8bd2dd359
BLAKE2b-256 e1d20348e85ca45f8aa786563feb7925cd768ed404e6cdb10d608c27cebdad6b

See more details on using hashes here.

Supported by

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