Name | kaa-rest-server JSON |
Version |
0.3.3
JSON |
| download |
home_page | None |
Summary | A very simple python REST server |
upload_time | 2024-10-25 19:05:39 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | MIT License Copyright (c) 2020 elpeix Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
server
development
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Kaa REST Server
A very simple python server framework for REST applications.
## Install
```console
pip install kaa-rest-server
```
## [Configuration](docs/configuration.md) - kaa.json
**kaa.json**: Specifies server handling.
```json
{
"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](docs/configuration.md).
### Definitions (deprecated)
See [Legacy Documentation](docs/legacy.md)
## Main classes
### server.py
Initializes Kaa for each http request:
```python
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):
```python
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.
```console
kaa serve
```
**Development mode** (dev): Start server that auto restarts on every code change.
```console
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:
```jsonc
{
// ...
"host": "localhost",
"port": 5111,
// ...
}
```
Or in command line:
```console
kaa serve host:port
```
## More
For more information, [view Documentation](docs/README.md).
Raw data
{
"_id": null,
"home_page": null,
"name": "kaa-rest-server",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "server, development",
"author": null,
"author_email": "Francesc d'Ass\u00eds Requesens i Roca <francesc.requesens@proton.me>",
"download_url": "https://files.pythonhosted.org/packages/e7/5e/f6089d6e6fa77746acfc7141137c99bf4bd8cbe734a50cf709001a5dcd65/kaa_rest_server-0.3.3.tar.gz",
"platform": null,
"description": "# Kaa REST Server\n\nA very simple python server framework for REST applications.\n\n## Install\n\n```console\npip install kaa-rest-server\n```\n\n## [Configuration](docs/configuration.md) - kaa.json\n\n**kaa.json**: Specifies server handling.\n\n```json\n{\n \"name\": \"My Server\",\n \"version\": \"1.0.0\",\n \"server\": \"server.MyServer\",\n \"debug\": false,\n \"enableCors\": false,\n \"developmentPolling\": {\n \"enabled\": true,\n \"intervalSeconds\": 1,\n \"include\": [\".\", \"src\", \"*.py\"],\n \"exclude\": [\n \"docs\",\n \"tests\",\n \"__pycache__\",\n \"*.md\"\n ]\n }\n}\n```\n\nSee [Configuration](docs/configuration.md).\n\n### Definitions (deprecated)\n\nSee [Legacy Documentation](docs/legacy.md)\n\n## Main classes\n\n### server.py\n\nInitializes Kaa for each http request:\n\n```python\nfrom kaa import KaaServer\n\n\nclass MyServer(KaaServer):\n\n def register_resources(self):\n self.kaa.register_resources(\"resources\", \"AppResources\")\n```\n\n### resources.py\n\nThis class define your resources (or routes):\n\n```python\nfrom kaa import GET, PATH, Resources, Response, Status\n\n\nclass AppResources(Resources):\n\n @GET\n @PATH(\"/\")\n def basic_resource(self, **params):\n return Response(Status.OK).json({\n \"message\": \"your response\"\n })\n```\n\n## Starting server\n\n**Static mode** (serve): Starts Kaa server in static mode. Every code change\nneeds restart server manually.\n\n```console\nkaa serve\n```\n\n**Development mode** (dev): Start server that auto restarts on every code change.\n\n```console\nkaa dev\n```\n\n## Custom host and port\n\nBy default host is localhost and port is 5321.\n\nYou can change them adding host and port on kaa.json file:\n\n```jsonc\n{\n // ...\n \"host\": \"localhost\",\n \"port\": 5111,\n // ...\n}\n```\n\nOr in command line:\n\n```console\nkaa serve host:port\n```\n\n## More\n\nFor more information, [view Documentation](docs/README.md).\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2020 elpeix Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "A very simple python REST server",
"version": "0.3.3",
"project_urls": {
"Bug Reports": "https://github.com/elpeix/kaa",
"Homepage": "https://github.com/elpeix/kaa",
"Source": "https://github.com/elpeix/kaa"
},
"split_keywords": [
"server",
" development"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "85c600f0e8b598fabd3013ac2425bc8766cae01e82d9717fa7ba2e92261e6eee",
"md5": "1b3637486d619ae9aae7316f1c27410a",
"sha256": "c96e13719f68977e2f9900100c32a512aaf15ae66ed42bf481019773161a3dfa"
},
"downloads": -1,
"filename": "kaa_rest_server-0.3.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1b3637486d619ae9aae7316f1c27410a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 16870,
"upload_time": "2024-10-25T19:05:36",
"upload_time_iso_8601": "2024-10-25T19:05:36.687233Z",
"url": "https://files.pythonhosted.org/packages/85/c6/00f0e8b598fabd3013ac2425bc8766cae01e82d9717fa7ba2e92261e6eee/kaa_rest_server-0.3.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e75ef6089d6e6fa77746acfc7141137c99bf4bd8cbe734a50cf709001a5dcd65",
"md5": "9a009b215f2f9fc908454e336d00737a",
"sha256": "5346e9a7605f58d5fc3d7b86398ed403fdceba1d9eeb44787c945d94a2db3096"
},
"downloads": -1,
"filename": "kaa_rest_server-0.3.3.tar.gz",
"has_sig": false,
"md5_digest": "9a009b215f2f9fc908454e336d00737a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 14065,
"upload_time": "2024-10-25T19:05:39",
"upload_time_iso_8601": "2024-10-25T19:05:39.452870Z",
"url": "https://files.pythonhosted.org/packages/e7/5e/f6089d6e6fa77746acfc7141137c99bf4bd8cbe734a50cf709001a5dcd65/kaa_rest_server-0.3.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-25 19:05:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "elpeix",
"github_project": "kaa",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "kaa-rest-server"
}