Skip to main content

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.2.1

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="127.0.0.1",
    port=8000
)

app = server.wsgi_app

def root(request: nkapi.NKRequest):
    return nkapi.NKResponse(
        headers={"Content-Type": "application/json"},
        body={
            "method": request.method,
            "path": request.path,
            "query": request.query,
            "headers": request.headers,
            "body": request.body
        }
    )

server.router.register(methods=["GET", "POST"], path="/", view=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

nkapi-0.2.2.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

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

nkapi-0.2.2-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file nkapi-0.2.2.tar.gz.

File metadata

  • Download URL: nkapi-0.2.2.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for nkapi-0.2.2.tar.gz
Algorithm Hash digest
SHA256 c938d68da8856ed63a63500b0fbb063e1f8cd17d471291f68d405c40dd16b400
MD5 ceee06044728ef8908e3432791c86cbc
BLAKE2b-256 06dce2eaf9feea27bc13de35f9a373a74ddeed55622ba14ca78281566a0da66e

See more details on using hashes here.

File details

Details for the file nkapi-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: nkapi-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for nkapi-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f512d560810e6a4ef4eca2d3213e0c270826e80fdbd5683dfec846078784ad8a
MD5 ea379058da282df3f1f1a4da1f1c8a0a
BLAKE2b-256 ec4515667b34363e0cb863882d731d2646ac1b5c75f560775e3c743c58c4e023

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