items.py — fastapi Source File
Architecture documentation for items.py, a python file in the fastapi codebase. 2 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 06e47017_eb47_e083_a998_dfdc38870ede["items.py"] fda7270c_173c_60d4_967d_bb9236d42531["dependencies"] 06e47017_eb47_e083_a998_dfdc38870ede --> fda7270c_173c_60d4_967d_bb9236d42531 534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"] 06e47017_eb47_e083_a998_dfdc38870ede --> 534f6e44_61b8_3c38_8b89_6934a6df9802 style 06e47017_eb47_e083_a998_dfdc38870ede fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from fastapi import APIRouter, Depends, HTTPException
from ..dependencies import get_token_header
router = APIRouter(
prefix="/items",
tags=["items"],
dependencies=[Depends(get_token_header)],
responses={404: {"description": "Not found"}},
)
fake_items_db = {"plumbus": {"name": "Plumbus"}, "gun": {"name": "Portal Gun"}}
@router.get("/")
async def read_items():
return fake_items_db
@router.get("/{item_id}")
async def read_item(item_id: str):
if item_id not in fake_items_db:
raise HTTPException(status_code=404, detail="Item not found")
return {"name": fake_items_db[item_id]["name"], "item_id": item_id}
@router.put(
"/{item_id}",
tags=["custom"],
responses={403: {"description": "Operation forbidden"}},
)
async def update_item(item_id: str):
if item_id != "plumbus":
raise HTTPException(
status_code=403, detail="You can only update the item: plumbus"
)
return {"item_id": item_id, "name": "The great Plumbus"}
Domain
Subdomains
Functions
Dependencies
- __init__.py
- dependencies
Source
Frequently Asked Questions
What does items.py do?
items.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Applications subdomain.
What functions are defined in items.py?
items.py defines 3 function(s): read_item, read_items, update_item.
What does items.py depend on?
items.py imports 2 module(s): __init__.py, dependencies.
Where is items.py in the architecture?
items.py is located at docs_src/bigger_applications/app_an_py39/routers/items.py (domain: FastAPI, subdomain: Applications, directory: docs_src/bigger_applications/app_an_py39/routers).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free