pryscraper/routers/__init__.py
cryptorugmunch 07288a01d7
All checks were successful
CI / typecheck (push) Successful in 51s
CI / Secret scan (gitleaks) (push) Successful in 32s
CI / lint (push) Successful in 47s
CI / Security audit (bandit) (push) Successful in 35s
CI / test (push) Successful in 1m20s
feat(db): add Alembic migrations (#6)
2026-07-03 02:22:33 +02:00

49 lines
1.5 KiB
Python

"""Pry API routers.
Each module in this package groups FastAPI endpoints by their `tags` field
(see api.py). The original api.py had 195 endpoints across 52 tags in a
single 4,668-line file. This package splits them so each router is
~50-300 lines (per CONVENTIONS.md, no file over 500 lines).
Pattern for each router file:
from fastapi import APIRouter, Body, Query
from typing import Any
from errors import NotFoundError # if needed
router = APIRouter(tags=["Auth"])
@router.post("/v1/auth/credentials", summary="...")
async def store_credentials(...):
...
Then in api.py:
from routers.auth import router as auth_router
app.include_router(auth_router)
Migration order (one router at a time, each as a separate commit):
1. auth - done
2. health - easy (3 endpoints, no business logic)
3. scraping - core, but well-bounded
4. extraction - similar
5. ... see docs/adr/0003-api-router-split.md for the full plan
The full split is a multi-hour refactor; this package is the
infrastructure for it. The first commit (this file + routers/auth.py)
demonstrates the pattern; subsequent commits can add more routers
without changing the overall structure.
Part of Pry - https://git.rugmunch.io/RugMunchMedia/pryscraper
Licensed under MIT. See LICENSE.
"""
# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Rug Munch Media LLC
#
# Part of Pry - https://git.rugmunch.io/RugMunchMedia/pryscraper
# Licensed under MIT. See LICENSE.
__all__: list[str] = [
"auth_router",
"health_router",
"templates_router",
]