- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 28 for Buterin (0.2 sec)
-
docs_src/extra_models/tutorial002_py310.py
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): return "supersecret" + raw_password def fake_save_user(user_in: UserIn): hashed_password = fake_password_hasher(user_in.password)
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Jan 07 14:11:31 GMT 2022 - 792 bytes - Viewed (0) -
docs_src/response_model/tutorial003_py310.py
from pydantic import BaseModel, EmailStr app = FastAPI() class UserIn(BaseModel): username: str password: str email: EmailStr full_name: str | None = None class UserOut(BaseModel): username: str email: EmailStr full_name: str | None = None @app.post("/user/", response_model=UserOut) async def create_user(user: UserIn) -> Any:
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Jan 07 13:45:48 GMT 2023 - 431 bytes - Viewed (0) -
docs/en/docs/tutorial/response-model.md
`BaseUser` has the base fields. Then `UserIn` inherits from `BaseUser` and adds the `password` field, so, it will include all the fields from both models. We annotate the function return type as `BaseUser`, but we are actually returning a `UserIn` instance.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 17.9K bytes - Viewed (0) -
docs/zh/docs/tutorial/response-model.md
但最重要的是: * 会将输出数据限制在该模型定义内。下面我们会看到这一点有多重要。 !!! note "技术细节" 响应模型在参数中被声明,而不是作为函数返回类型的注解,这是因为路径函数可能不会真正返回该响应模型,而是返回一个 `dict`、数据库对象或其他模型,然后再使用 `response_model` 来执行字段约束和序列化。 ## 返回与输入相同的数据 现在我们声明一个 `UserIn` 模型,它将包含一个明文密码属性。 ```Python hl_lines="9 11" {!../../../docs_src/response_model/tutorial002.py!} ``` 我们正在使用此模型声明输入数据,并使用同一模型声明输出数据: ```Python hl_lines="17-18"
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 7.9K bytes - Viewed (0) -
docs/ja/docs/tutorial/response-model.md
!!! note "技術詳細" レスポンスモデルは、関数の戻り値のアノテーションではなく、このパラメータで宣言されています。なぜなら、パス関数は実際にはそのレスポンスモデルを返すのではなく、`dict`やデータベースオブジェクト、あるいは他のモデルを返し、`response_model`を使用してフィールドの制限やシリアライズを行うからです。 ## 同じ入力データの返却 ここでは`UserIn`モデルを宣言しています。それには平文のパスワードが含まれています: ```Python hl_lines="9 11" {!../../../docs_src/response_model/tutorial002.py!} ``` そして、このモデルを使用して入力を宣言し、同じモデルを使って出力を宣言しています: ```Python hl_lines="17 18"
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 9.3K bytes - Viewed (0) -
docs_src/response_model/tutorial003.py
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Jan 07 13:45:48 GMT 2023 - 450 bytes - Viewed (0) -
docs/ru/docs/tutorial/extra-models.md
``` ### Про `**user_in.dict()` #### `.dict()` из Pydantic `user_in` - это Pydantic-модель класса `UserIn`. У Pydantic-моделей есть метод `.dict()`, который возвращает `dict` с данными модели. Поэтому, если мы создадим Pydantic-объект `user_in` таким способом: ```Python user_in = UserIn(username="john", password="secret", email="******@****.***") ``` и затем вызовем: ```Python
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 11.6K bytes - Viewed (0) -
docs/en/docs/tutorial/extra-models.md
### About `**user_in.dict()` #### Pydantic's `.dict()` `user_in` is a Pydantic model of class `UserIn`. Pydantic models have a `.dict()` method that returns a `dict` with the model's data. So, if we create a Pydantic object `user_in` like: ```Python user_in = UserIn(username="john", password="secret", email="******@****.***") ``` and then we call: ```Python
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 7.7K bytes - Viewed (1) -
docs_src/extra_models/tutorial001.py
return "supersecret" + raw_password def fake_save_user(user_in: UserIn): hashed_password = fake_password_hasher(user_in.password) user_in_db = UserInDB(**user_in.dict(), hashed_password=hashed_password) print("User saved! ..not really") return user_in_db @app.post("/user/", response_model=UserOut) async def create_user(user_in: UserIn): user_saved = fake_save_user(user_in)
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat May 14 11:59:59 GMT 2022 - 943 bytes - Viewed (0) -
docs_src/extra_models/tutorial001_py310.py
return "supersecret" + raw_password def fake_save_user(user_in: UserIn): hashed_password = fake_password_hasher(user_in.password) user_in_db = UserInDB(**user_in.dict(), hashed_password=hashed_password) print("User saved! ..not really") return user_in_db @app.post("/user/", response_model=UserOut) async def create_user(user_in: UserIn): user_saved = fake_save_user(user_in)
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Jan 07 14:11:31 GMT 2022 - 899 bytes - Viewed (0)