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_pagesorhas_nextever again. - ✅ Universal: Works with FastAPI, Flask, Django, or scripts.
Project details
Release history Release notifications | RSS feed
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcdfaf993c797ab8518e7bfbaa8f750e8e963b4ff229f2f0c7fbad7a83afe4a0
|
|
| MD5 |
3beb43cdd1d1ce2f27099c043d5e898f
|
|
| BLAKE2b-256 |
32b40a4679c2862d84b0aea110da54603519cc20aad1d6d7cf0b8ed591da3ffa
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac57feeb90f819de60a5e9f7dfa429f7c073ee3cd5770b17db8e23fe51f6e699
|
|
| MD5 |
e9410ef4ac7d06604721b7f5b8159903
|
|
| BLAKE2b-256 |
f614ce3fe67b8415784b8c3486a24d3d69d2fc172d9a59fd203e0c8b131a9db9
|