- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 59 for instance (0.43 sec)
-
tests/test_jsonable_encoder.py
pass class MyModel(BaseModel): dt_field: safe_datetime instance = MyModel(dt_field=safe_datetime.now()) encoded_instance = jsonable_encoder( instance, custom_encoder={safe_datetime: lambda o: o.isoformat()} ) assert encoded_instance["dt_field"] == instance.dt_field.isoformat() def test_custom_enum_encoders(): def custom_enum_encoder(v: Enum):
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Thu Apr 18 21:56:59 GMT 2024 - 9K bytes - Viewed (0) -
docs/en/docs/tutorial/dependencies/classes-as-dependencies.md
then it is a "callable". ## Classes as dependencies You might notice that to create an instance of a Python class, you use that same syntax. For example: ```Python class Cat: def __init__(self, name: str): self.name = name fluffy = Cat(name="Mr Fluffy") ``` In this case, `fluffy` is an instance of the class `Cat`. And to create `fluffy`, you are "calling" `Cat`.
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 11.4K bytes - Viewed (0) -
fastapi/security/api_key.py
the key value sent in the query parameter automatically and provides it as the dependency result. But it doesn't define how to send that API key to the client. ## Usage Create an instance object and use that object as the dependency in `Depends()`. The dependency result will be a string containing the key value. ## Example ```python from fastapi import Depends, FastAPI
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Tue Apr 23 22:29:18 GMT 2024 - 9.1K bytes - Viewed (0) -
docs/en/docs/reference/response.md
# `Response` class You can declare a parameter in a *path operation function* or dependency to be of type `Response` and then you can set data for the response like headers or cookies. You can also use it directly to create an instance of it and return it from your *path operations*. You can import it directly from `fastapi`: ```python from fastapi import Response ```
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 397 bytes - Viewed (0) -
docs/en/docs/tutorial/sql-databases.md
### Create a `SessionLocal` class Each instance of the `SessionLocal` class will be a database session. The class itself is not a database session yet. But once we create an instance of the `SessionLocal` class, this instance will be the actual database session. We name it `SessionLocal` to distinguish it from the `Session` we are importing from SQLAlchemy.
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 29.6K bytes - Viewed (0) -
docs/vi/docs/tutorial/first-steps.md
### Bước 2: Tạo một `FastAPI` "instance" ```Python hl_lines="3" {!../../../docs_src/first_steps/tutorial001.py!} ``` Biến `app` này là một "instance" của class `FastAPI`. Đây sẽ là điểm cốt lõi để tạo ra tất cả API của bạn. `app` này chính là điều được nhắc tới bởi `uvicorn` trong câu lệnh:
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Sat Sep 02 15:44:17 GMT 2023 - 11.2K bytes - Viewed (0) -
docs/en/docs/advanced/settings.md
{!> ../../../docs_src/settings/tutorial001_pv1.py!} ``` !!! tip If you want something quick to copy and paste, don't use this example, use the last one below. Then, when you create an instance of that `Settings` class (in this case, in the `settings` object), Pydantic will read the environment variables in a case-insensitive way, so, an upper-case variable `APP_NAME` will still be read for the attribute `app_name`.
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 15.7K bytes - Viewed (0) -
docs/en/docs/how-to/custom-docs-ui-assets.md
│ ├── main.py └── static ├── redoc.standalone.js ├── swagger-ui-bundle.js └── swagger-ui.css ``` ### Serve the static files * Import `StaticFiles`. * "Mount" a `StaticFiles()` instance in a specific path. ```Python hl_lines="7 11" {!../../../docs_src/custom_docs_ui/tutorial002.py!} ``` ### Test the static files
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Mon Oct 30 09:58:58 GMT 2023 - 7.5K bytes - Viewed (0) -
docs/en/docs/tutorial/path-params-numeric-validations.md
!!! note "Technical Details" When you import `Query`, `Path` and others from `fastapi`, they are actually functions. That when called, return instances of classes of the same name. So, you import `Query`, which is a function. And when you call it, it returns an instance of a class also named `Query`. These functions are there (instead of just using the classes directly) so that your editor doesn't mark errors about their types.
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Thu Jan 11 16:31:18 GMT 2024 - 9.1K bytes - Viewed (0) -
docs/es/docs/python-types.md
Tú declaras la "forma" de los datos mediante clases con atributos. Cada atributo tiene un tipo. Luego creas un instance de esa clase con algunos valores y Pydantic validará los valores, los convertirá al tipo apropiado (si ese es el caso) y te dará un objeto con todos los datos. Y obtienes todo el soporte del editor con el objeto resultante.
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 9.2K bytes - Viewed (0)