Skip to main content

A very simple python REST server

Project description

Kaa REST Server

A very simple python server framework for REST applications.

Install

pip install kaa-rest-server

Configuration - kaa.json

kaa.json: Specifies server handling.

{
  "name": "My Server",
  "version": "1.0.0",
  "server": "server.MyServer",
  "debug": false,
  "enableCors": false,
  "developmentPolling": {
    "enabled": true,
    "intervalSeconds": 1,
    "include": [".", "src", "*.py"],
    "exclude": ["docs", "tests", "__pycache__", "*.md"]
  }
}

See Configuration.

Definitions (deprecated)

See Legacy Documentation

Main classes

server.py

Initializes Kaa for each http request:

from kaa import KaaServer


class MyServer(KaaServer):

    def register_resources(self):
        self.kaa.register_resources("resources", "AppResources")

resources.py

This class define your resources (or routes):

from kaa import GET, PATH, Resources, Response, Status


class AppResources(Resources):

    @GET
    @PATH("/")
    def basic_resource(self, **params):
        return Response(Status.OK).json({
            "message": "your response"
        })

Starting server

Static mode (serve): Starts Kaa server in static mode. Every code change needs restart server manually.

kaa serve

Development mode (dev): Start server that auto restarts on every code change.

kaa dev

Custom host and port

By default host is localhost and port is 5321.

You can change them adding host and port on kaa.json file:

{
  // ...
  "host": "localhost",
  "port": 5111,
  // ...
}

Or in command line:

kaa serve host:port

More

For more information, view Documentation.

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

kaa_rest_server-0.3.4.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

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

kaa_rest_server-0.3.4-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file kaa_rest_server-0.3.4.tar.gz.

File metadata

  • Download URL: kaa_rest_server-0.3.4.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.11

File hashes

Hashes for kaa_rest_server-0.3.4.tar.gz
Algorithm Hash digest
SHA256 5746528d436f3e1f1bc04909bdfff896bea0df2093c0158d70f6ff7e3945fbb1
MD5 8a27dcdccb0012b2dd21d22e836c6719
BLAKE2b-256 e2b95a7c725e7dc9ebf82c1fa0e3b1231b0482847de5fe2455bf2d1ffdf8c038

See more details on using hashes here.

File details

Details for the file kaa_rest_server-0.3.4-py3-none-any.whl.

File metadata

File hashes

Hashes for kaa_rest_server-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 88f50f84894ebacda0e397cdb9c63cb92e802b138c10ae26867c0608734b6085
MD5 be52f57cbe97382e4d0fc99b5acc8032
BLAKE2b-256 2e928328d9b2fc4348ae99c558a960e8cefd5ff36b930d21cf39876081d09267

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