Skip to main content

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

pocketapi_framework-0.1.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

pocketapi_framework-0.1.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

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

Hashes for pocketapi_framework-0.1.0.tar.gz
Algorithm Hash digest
SHA256 59770db47f0ef15259d3f4801576289d40ebbb1478acd8866a9bdbb95ddab487
MD5 1814571366fcbecc7578bba640acbaa9
BLAKE2b-256 91f79a98ddd520985332f35587d2ff0d34873aab8b0655f307b044df854abac2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pocketapi_framework-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19792b017b0ff16b5fae206a8b82a0efcf659f2e9c635c16005d61f854c5d0af
MD5 9d0fb1659152eceb39aa7ebf96e5285b
BLAKE2b-256 20eb338dfc425e00577e7ea7122e1b874df3d4e2f05443c6b088f5e714fa4395

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page