Skip to main content

A lightweight and standardized API response utility for Python web API frameworks.

Project description

Protogrid

Standardized, Type-Safe API Responses for Python.

Protogrid is a lightweight library that enforces a consistent JSON structure for your API responses. It handles pagination math, error formatting, and metadata automatically.

Quick Start

from protogrid import make_response

# youre response data/payload
items_list = {
    "user_id": 123,
    "name": "Alice"
}

# Standard Response
return make_response(
    status=200, #or "ok" or APIStatus.OK 
    message="Manual Bad Request", #or None
    payload=items_list, #or None
    
    #only if you need pagination 
    page=1, #or None
    limit=10, #or None
    total_items=10, #or None
    include_meta=True, #or False (default: True) include request_id and timestamp
    error_details="Manual Bad Request" #default: None , used 
)

Response Structure

{
  "success": true,
  "message": "Manual Bad Request",
  "http_code": 200,
  "payload": {
    "user_id": 123,
    "name": "Alice"
  },
  "pagination": {
    "page": 1,
    "limit": 10,
    "total_items": 100,
    "total_pages": 10,
    "has_next": true,
    "has_prev": false
  },
  "error": null,
  "meta": {
    "timestamp": "2026-02-13T15:58:20.000Z",
    "request_id": "req_123e4567-e89b-12d3-a456-426614174000"
  }
}

Why use Protogrid?

  • Consistent: Always return the same JSON structure.
  • Lazy: Don't manually calculate total_pages or has_next ever again.
  • Universal: Works with FastAPI, Flask, Django, or scripts.

👉 Full Documentation & Source Code on GitHub

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

protogrid-0.1.0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

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

protogrid-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file protogrid-0.1.0.tar.gz.

File metadata

  • Download URL: protogrid-0.1.0.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for protogrid-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bcdfaf993c797ab8518e7bfbaa8f750e8e963b4ff229f2f0c7fbad7a83afe4a0
MD5 3beb43cdd1d1ce2f27099c043d5e898f
BLAKE2b-256 32b40a4679c2862d84b0aea110da54603519cc20aad1d6d7cf0b8ed591da3ffa

See more details on using hashes here.

File details

Details for the file protogrid-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: protogrid-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for protogrid-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac57feeb90f819de60a5e9f7dfa429f7c073ee3cd5770b17db8e23fe51f6e699
MD5 e9410ef4ac7d06604721b7f5b8159903
BLAKE2b-256 f614ce3fe67b8415784b8c3486a24d3d69d2fc172d9a59fd203e0c8b131a9db9

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