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)
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
Built Distribution
File details
Details for the file kaa_rest_server-0.3.3.tar.gz
.
File metadata
- Download URL: kaa_rest_server-0.3.3.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5346e9a7605f58d5fc3d7b86398ed403fdceba1d9eeb44787c945d94a2db3096 |
|
MD5 | 9a009b215f2f9fc908454e336d00737a |
|
BLAKE2b-256 | e75ef6089d6e6fa77746acfc7141137c99bf4bd8cbe734a50cf709001a5dcd65 |
File details
Details for the file kaa_rest_server-0.3.3-py3-none-any.whl
.
File metadata
- Download URL: kaa_rest_server-0.3.3-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c96e13719f68977e2f9900100c32a512aaf15ae66ed42bf481019773161a3dfa |
|
MD5 | 1b3637486d619ae9aae7316f1c27410a |
|
BLAKE2b-256 | 85c600f0e8b598fabd3013ac2425bc8766cae01e82d9717fa7ba2e92261e6eee |