Home / File/ tutorial012_an_py39.py — fastapi Source File

tutorial012_an_py39.py — fastapi Source File

Architecture documentation for tutorial012_an_py39.py, a python file in the fastapi codebase. 2 imports, 0 dependents.

File python FastAPI Routing 2 imports 4 functions

Entity Profile

Dependency Diagram

graph LR
  12508efb_5e0f_6c7d_1818_bc97a30e8eb0["tutorial012_an_py39.py"]
  0dda2280_3359_8460_301c_e98c77e78185["typing"]
  12508efb_5e0f_6c7d_1818_bc97a30e8eb0 --> 0dda2280_3359_8460_301c_e98c77e78185
  534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"]
  12508efb_5e0f_6c7d_1818_bc97a30e8eb0 --> 534f6e44_61b8_3c38_8b89_6934a6df9802
  style 12508efb_5e0f_6c7d_1818_bc97a30e8eb0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from typing import Annotated

from fastapi import Depends, FastAPI, Header, HTTPException


async def verify_token(x_token: Annotated[str, Header()]):
    if x_token != "fake-super-secret-token":
        raise HTTPException(status_code=400, detail="X-Token header invalid")


async def verify_key(x_key: Annotated[str, Header()]):
    if x_key != "fake-super-secret-key":
        raise HTTPException(status_code=400, detail="X-Key header invalid")
    return x_key


app = FastAPI(dependencies=[Depends(verify_token), Depends(verify_key)])


@app.get("/items/")
async def read_items():
    return [{"item": "Portal Gun"}, {"item": "Plumbus"}]


@app.get("/users/")
async def read_users():
    return [{"username": "Rick"}, {"username": "Morty"}]

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does tutorial012_an_py39.py do?
tutorial012_an_py39.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Routing subdomain.
What functions are defined in tutorial012_an_py39.py?
tutorial012_an_py39.py defines 4 function(s): read_items, read_users, verify_key, verify_token.
What does tutorial012_an_py39.py depend on?
tutorial012_an_py39.py imports 2 module(s): __init__.py, typing.
Where is tutorial012_an_py39.py in the architecture?
tutorial012_an_py39.py is located at docs_src/dependencies/tutorial012_an_py39.py (domain: FastAPI, subdomain: Routing, directory: docs_src/dependencies).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free