A lightweight general purpose API framework. Designed to make getting started quick and easy.
Project description
NKAPI
A lightweight general-purpose API framework for Python. Designed to make getting started quick and easy, NKAPI is inspired by Flask and Django but keeps things minimal and straightforward.
Version: 0.1.2
Installation
Install NKAPI via pip (from PyPI, if published):
pip install nkapi
Or install directly from source:
git clone https://github.com/nickkipshidze/python-nkapi.git
cd python-nkapi
pip install .
Quick Start
Here’s a minimal example of using NKAPI:
import nkapi
server = nkapi.NKServer(
host="0.0.0.0",
port=8000
)
app = server.wsgi_app
def root(request: nkapi.NKRequest):
return nkapi.NKResponse(
headers={"Content-Type": "application/json"},
data={
"method": request.method,
"path": request.path,
"query": request.query,
"headers": request.headers,
"body": request.body
}
)
server.router.register(methods=["GET", "POST"], path="/", callback=root)
if __name__ == "__main__":
server.start()
Start the server and visit http://127.0.0.1:8000/ in your browser. You will see a JSON response containing the request details.
Here's an example on how to use the WSGI app with Gunicorn:
$ gunicorn -w 4 -b 0.0.0.0 app:app --access-logfile -
Logging
NKAPI logs requests to the console in the following format:
<client_ip> - - [timestamp] "METHOD PATH HTTP/version" STATUS -
License
MIT License – see LICENSE file for details.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nkapi-0.1.2.tar.gz.
File metadata
- Download URL: nkapi-0.1.2.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41e0697c120d3f4c67a92369421781621586f2d341a279ae4597bb6dc30efb1e
|
|
| MD5 |
9fddc429bd207c3059d9ad2bdc2aba53
|
|
| BLAKE2b-256 |
6bee0d70b160e2233a340d481f6a1c024211563d631b9c6fb1683e82c23d61e2
|
File details
Details for the file nkapi-0.1.2-py3-none-any.whl.
File metadata
- Download URL: nkapi-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b3ce1318e01021007ae9bea28e8797a89fb40be006beec6daa5491789f9bbc8
|
|
| MD5 |
ee800445d7a19df6efe26e08f4a1d43c
|
|
| BLAKE2b-256 |
7548c07234ac1334cb4b0f4e02601d50812a9ef9d082acc3303b599399c00477
|