- Sort Score
- Num 10 results
- Language All
Results 221 - 230 of 668 for pydantic (0.06 seconds)
The search processing time has exceeded the limit. The displayed results may be partial.
-
docs_src/extra_models/tutorial002_py310.py
from fastapi import FastAPI from pydantic import BaseModel, EmailStr app = FastAPI() class UserBase(BaseModel): username: str email: EmailStr full_name: str | None = None class UserIn(UserBase): password: str class UserOut(UserBase): pass class UserInDB(UserBase): hashed_password: str def fake_password_hasher(raw_password: str):
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sat Dec 20 15:55:38 GMT 2025 - 798 bytes - Click Count (0) -
docs_src/security/tutorial002_an_py310.py
from typing import Annotated from fastapi import Depends, FastAPI from fastapi.security import OAuth2PasswordBearer from pydantic import BaseModel app = FastAPI() oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token") class User(BaseModel): username: str email: str | None = None full_name: str | None = None disabled: bool | None = None def fake_decode_token(token): return User(
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sat Mar 18 12:29:59 GMT 2023 - 761 bytes - Click Count (0) -
docs/ja/docs/python-types.md
「`one_person` は `Person` という名前の **クラス** である」という意味ではありません。 ## Pydantic のモデル { #pydantic-models } [Pydantic](https://docs.pydantic.dev/) はデータ検証を行うための Python ライブラリです。 データの「形」を属性付きのクラスとして宣言します。 そして、それぞれの属性は型を持ちます。 さらに、いくつかの値を持つクラスのインスタンスを作成すると、その値を検証し、適切な型に変換して(もしそうであれば)すべてのデータを持つオブジェクトを提供してくれます。 また、その結果のオブジェクトですべてのエディタのサポートを受けることができます。 Pydantic の公式ドキュメントからの例:Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:07:17 GMT 2026 - 14.3K bytes - Click Count (0) -
docs/en/mkdocs.yml
- deployment/cloud.md - deployment/server-workers.md - deployment/docker.md - How To - Recipes: - how-to/index.md - how-to/general.md - how-to/migrate-from-pydantic-v1-to-pydantic-v2.md - how-to/graphql.md - how-to/custom-request-and-route.md - how-to/conditional-openapi.md - how-to/extending-openapi.md - how-to/separate-openapi-schemas.mdCreated: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Apr 01 16:16:24 GMT 2026 - 9.9K bytes - Click Count (0) -
docs/zh/docs/advanced/security/oauth2-scopes.md
## 校验 `username` 与数据形状 { #verify-the-username-and-data-shape } 我们校验是否获取到了 `username`,并提取作用域。 然后使用 Pydantic 模型验证这些数据(捕获 `ValidationError` 异常),如果读取 JWT 令牌或用 Pydantic 验证数据时出错,就抛出我们之前创建的 `HTTPException`。 为此,我们给 Pydantic 模型 `TokenData` 添加了一个新属性 `scopes`。 通过用 Pydantic 验证数据,我们可以确保确实得到了例如一个由作用域组成的 `list[str]`,以及一个 `str` 类型的 `username`。 而不是,例如得到一个 `dict` 或其它什么,这可能会在后续某个时刻破坏应用,形成安全风险。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:06:37 GMT 2026 - 13K bytes - Click Count (0) -
scripts/topic_repos.py
import logging import secrets import subprocess from pathlib import Path import yaml from github import Github from pydantic import BaseModel, SecretStr from pydantic_settings import BaseSettings class Settings(BaseSettings): github_repository: str github_token: SecretStr class Repo(BaseModel): name: str html_url: str stars: int owner_login: str owner_html_url: str
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Dec 16 12:34:01 GMT 2025 - 2.7K bytes - Click Count (0) -
docs_src/schema_extra_example/tutorial005_an_py310.py
from typing import Annotated from fastapi import Body, FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: str | None = None price: float tax: float | None = None @app.put("/items/{item_id}") async def update_item( *, item_id: int, item: Annotated[ Item, Body( openapi_examples={
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sat Aug 26 18:03:13 GMT 2023 - 1.5K bytes - Click Count (0) -
docs_src/app_testing/app_b_py310/main.py
from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel fake_secret_token = "coneofsilence" fake_db = { "foo": {"id": "foo", "title": "Foo", "description": "There goes my hero"}, "bar": {"id": "bar", "title": "Bar", "description": "The bartenders"}, } app = FastAPI() class Item(BaseModel): id: str title: str description: str | None = None
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Feb 04 13:32:24 GMT 2026 - 1.1K bytes - Click Count (0) -
tests/test_compat.py
from fastapi._compat import ( Undefined, is_uploadfile_sequence_annotation, ) from fastapi._compat.shared import is_bytes_sequence_annotation from fastapi.testclient import TestClient from pydantic import BaseModel, ConfigDict from pydantic.fields import FieldInfo def test_model_field_default_required(): from fastapi._compat import v2 # For coverage field_info = FieldInfo(annotation=str)
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 4.2K bytes - Click Count (0) -
docs/zh-hant/docs/advanced/openapi-callbacks.md
它會有一個接收 `Invoice` body 的「路徑操作」,以及一個查詢參數 `callback_url`,其中包含用於回呼的 URL。 這部分很正常,多數程式碼你應該已經很熟悉了: {* ../../docs_src/openapi_callbacks/tutorial001_py310.py hl[7:11,34:51] *} /// tip `callback_url` 查詢參數使用的是 Pydantic 的 [Url](https://docs.pydantic.dev/latest/api/networks/) 型別。 /// 唯一新的地方是在「路徑操作裝飾器」中加入參數 `callbacks=invoices_callback_router.routes`。我們接下來會看到那是什麼。 ## 文件化回呼 { #documenting-the-callback } 實際的回呼程式碼會高度依賴你的 API 應用本身。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 7.5K bytes - Click Count (0)