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

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.0.tar.gz (13.7 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.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for nkapi-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7682c400702be83d0b8612026469b10922a9941229d0d4d3ea7f0992239f7a0c
MD5 c4fdffdd5204045f708d740f31fc69a0
BLAKE2b-256 382ae68e209f4a4dd17afa904481c6021a897a164eab320f491bb2b6515b5efa

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for nkapi-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a91c9291d4358e390db4d345844239a761158374791a15b039c531622235cc7
MD5 2f98414d913ffd20929defa54a381ca4
BLAKE2b-256 dc4a753663ad22ddb13d7a8fcbf2c06367bd63efea29161c7a5207062478d9da

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