- Sort Score
- Result 10 results
- Languages All
Results 181 - 190 of 781 for typing (0.03 sec)
-
docs_src/security/tutorial003_py39.py
from typing import Union from fastapi import Depends, FastAPI, HTTPException, status from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm from pydantic import BaseModel fake_users_db = { "johndoe": { "username": "johndoe", "full_name": "John Doe", "email": "******@****.***", "hashed_password": "fakehashedsecret", "disabled": False, }, "alice": {Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 2.4K bytes - Viewed (0) -
docs_src/additional_status_codes/tutorial001_an_py310.py
from typing import Annotated from fastapi import Body, FastAPI, status from fastapi.responses import JSONResponse app = FastAPI() items = {"foo": {"name": "Fighters", "size": 6}, "bar": {"name": "Tenders", "size": 3}} @app.put("/items/{item_id}") async def upsert_item( item_id: str, name: Annotated[str | None, Body()] = None, size: Annotated[int | None, Body()] = None, ): if item_id in items:
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 686 bytes - Viewed (0) -
pdm_build.py
import os from typing import Any from pdm.backend.hooks import Context TIANGOLO_BUILD_PACKAGE = os.getenv("TIANGOLO_BUILD_PACKAGE", "fastapi") def pdm_build_initialize(context: Context) -> None: metadata = context.config.metadata # Get custom config for the current package, from the env var config: dict[str, Any] = context.config.data["tool"]["tiangolo"][ "_internal-slim-build" ]["packages"].get(TIANGOLO_BUILD_PACKAGE)
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 691 bytes - Viewed (0) -
docs_src/background_tasks/tutorial002_an_py310.py
from typing import Annotated from fastapi import BackgroundTasks, Depends, FastAPI app = FastAPI() def write_log(message: str): with open("log.txt", mode="a") as log: log.write(message) def get_query(background_tasks: BackgroundTasks, q: str | None = None): if q: message = f"found query: {q}\n" background_tasks.add_task(write_log, message) return q
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 683 bytes - Viewed (0) -
docs_src/background_tasks/tutorial002_py39.py
from typing import Union from fastapi import BackgroundTasks, Depends, FastAPI app = FastAPI() def write_log(message: str): with open("log.txt", mode="a") as log: log.write(message) def get_query(background_tasks: BackgroundTasks, q: Union[str, None] = None): if q: message = f"found query: {q}\n" background_tasks.add_task(write_log, message) return q
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 675 bytes - Viewed (0) -
docs_src/body_multiple_params/tutorial001_an_py39.py
from typing import Annotated, Union from fastapi import FastAPI, Path from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: Union[str, None] = None price: float tax: Union[float, None] = None @app.put("/items/{item_id}") async def update_item( item_id: Annotated[int, Path(title="The ID of the item to get", ge=0, le=1000)], q: Union[str, None] = None,
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 610 bytes - Viewed (0) -
docs_src/extra_models/tutorial001_py39.py
from typing import Union from fastapi import FastAPI from pydantic import BaseModel, EmailStr app = FastAPI() class UserIn(BaseModel): username: str password: str email: EmailStr full_name: Union[str, None] = None class UserOut(BaseModel): username: str email: EmailStr full_name: Union[str, None] = None class UserInDB(BaseModel): username: str hashed_password: str
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 949 bytes - Viewed (0) -
docs_src/query_params_str_validations/tutorial015_an_py39.py
import random from typing import Annotated, Union from fastapi import FastAPI from pydantic import AfterValidator app = FastAPI() data = { "isbn-9781529046137": "The Hitchhiker's Guide to the Galaxy", "imdb-tt0371724": "The Hitchhiker's Guide to the Galaxy", "isbn-9781439512982": "Isaac Asimov: The Complete Stories, Vol. 2", } def check_valid_id(id: str): if not id.startswith(("isbn-", "imdb-")):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Mar 01 22:02:35 UTC 2025 - 781 bytes - Viewed (0) -
tests/test_stringified_annotations_simple.py
from __future__ import annotations from typing import Annotated from fastapi import Depends, FastAPI, Request from fastapi.testclient import TestClient from .utils import needs_py310 class Dep: def __call__(self, request: Request): return "test" @needs_py310 def test_stringified_annotations(): app = FastAPI() client = TestClient(app) @app.get("/test/")Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 545 bytes - Viewed (0) -
docs_src/schema_extra_example/tutorial001_py39.py
from typing import Union from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: Union[str, None] = None price: float tax: Union[float, None] = None model_config = { "json_schema_extra": { "examples": [ { "name": "Foo", "description": "A very nice Item",
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 684 bytes - Viewed (0)