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.1.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="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

nkapi-0.1.1.tar.gz (4.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.1.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for nkapi-0.1.1.tar.gz
Algorithm Hash digest
SHA256 29914a57b14d69e801113574d4e0e4da8d918fede9b6934742a8769c8793cf3a
MD5 1028791ebcc7e5cce715e7d7e930d692
BLAKE2b-256 7c9ce3fd16a02d048008d551db16abd81474de0814558d4f771ea514f838982d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nkapi-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a62ce376b9ecaa8b2b2be1c796f4e4fb5f8360197554b109992af70e7cb2d1c3
MD5 652628085df5dbf4ac02da3c5a035316
BLAKE2b-256 5a81b485d5a9e937c2c58b299fb870bd5382b8dd0114c53c1eb172ba418c6c0c

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