Pocket API
Zero-boilerplate REST API framework for Python.
Turn any Python file into a live REST API with auto-generated Swagger documentation. Just write functions — Pocket API handles the rest.
Installation
pip install pocketapi
Quick Start
Create a Python file with your functions:
# api.py
def hello(name: str = "World"):
"""Say hello to someone."""
return {"greeting": f"Hello, {name}!"}
def add(a: int, b: int):
"""Add two integers."""
return {"sum": a + b}
Then serve it:
pocketapi serve api.py
Now visit:
- API: http://localhost:8000/
- Docs: http://localhost:8000/docs
Test your endpoints:
curl "http://localhost:8000/hello?name=Alice"
# {"greeting": "Hello, Alice!"}
curl "http://localhost:8000/add?a=10&b=20"
# {"sum": 30}
Features
- Zero boilerplate — functions become endpoints automatically
- Type coercion — type hints auto-cast query parameters
- Swagger UI — interactive docs at
/docs - OpenAPI 3.0 — machine-readable spec at
/openapi.json - Error handling — missing params return 400, server errors return 500
License
MIT
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 pocketapi_framework-0.1.0.tar.gz.
File metadata
- Download URL: pocketapi_framework-0.1.0.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59770db47f0ef15259d3f4801576289d40ebbb1478acd8866a9bdbb95ddab487
|
|
| MD5 |
1814571366fcbecc7578bba640acbaa9
|
|
| BLAKE2b-256 |
91f79a98ddd520985332f35587d2ff0d34873aab8b0655f307b044df854abac2
|
File details
Details for the file pocketapi_framework-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pocketapi_framework-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19792b017b0ff16b5fae206a8b82a0efcf659f2e9c635c16005d61f854c5d0af
|
|
| MD5 |
9d0fb1659152eceb39aa7ebf96e5285b
|
|
| BLAKE2b-256 |
20eb338dfc425e00577e7ea7122e1b874df3d4e2f05443c6b088f5e714fa4395
|