- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 42 for we (2.04 sec)
-
docs/en/docs/advanced/testing-database.md
## Create the database Because now we are going to use a new database in a new file, we need to make sure we create the database with: ```Python Base.metadata.create_all(bind=engine) ``` That is normally called in `main.py`, but the line in `main.py` uses the database file `sql_app.db`, and we need to make sure we create `test.db` for the tests.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Jul 07 17:12:13 GMT 2023 - 3.5K bytes - Viewed (0) -
docs/en/docs/tutorial/security/get-current-user.md
``` But that is still not that useful. Let's make it give us the current user. ## Create a user model First, let's create a Pydantic user model. The same way we use Pydantic to declare bodies, we can use it anywhere else: === "Python 3.10+" ```Python hl_lines="5 12-16" {!> ../../../docs_src/security/tutorial002_an_py310.py!} ``` === "Python 3.9+"
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Jan 11 16:31:18 GMT 2024 - 7.6K bytes - Viewed (0) -
docs/en/docs/advanced/dataclasses.md
```{ .python .annotate hl_lines="1 5 8-11 14-17 23-25 28" } {!../../../docs_src/dataclasses/tutorial003.py!} ``` 1. We still import `field` from standard `dataclasses`. 2. `pydantic.dataclasses` is a drop-in replacement for `dataclasses`. 3. The `Author` dataclass includes a list of `Item` dataclasses.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 4.1K bytes - Viewed (0) -
docs/en/docs/advanced/middleware.md
And then you also read how to handle [CORS with the `CORSMiddleware`](../tutorial/cors.md){.internal-link target=_blank}. In this section we'll see how to use other middlewares. ## Adding ASGI middlewares As **FastAPI** is based on Starlette and implements the <abbr title="Asynchronous Server Gateway Interface">ASGI</abbr> specification, you can use any ASGI middleware.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 10 18:27:10 GMT 2023 - 4K bytes - Viewed (0) -
docs/en/docs/how-to/nosql-databases-couchbase.md
``` ## Create Pydantic models As **Couchbase** "documents" are actually just "JSON objects", we can model them with Pydantic. ### `User` model First, let's create a `User` model: ```Python hl_lines="24-28" {!../../../docs_src/nosql_databases/tutorial001.py!} ``` We will use this model in our *path operation function*, so, we don't include in it the `hashed_password`. ### `UserInDB` model
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Tue Jan 16 13:23:25 GMT 2024 - 6K bytes - Viewed (0) -
docs/en/docs/tutorial/security/first-steps.md
We can use **OAuth2** to build that with **FastAPI**. But let's save you the time of reading the full long specification just to find those little pieces of information you need. Let's use the tools provided by **FastAPI** to handle security. ## How it looks Let's first just use the code and see how it works, and then we'll come back to understand what's happening.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Wed Mar 13 19:02:19 GMT 2024 - 8.9K bytes - Viewed (0) -
docs/en/docs/how-to/custom-request-and-route.md
We can also use this same approach to access the request body in an exception handler. All we need to do is handle the request inside a `try`/`except` block: ```Python hl_lines="13 15" {!../../../docs_src/custom_request_and_route/tutorial002.py!} ``` If an exception occurs, the`Request` instance will still be in scope, so we can read and make use of the request body when handling the error:
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sun Mar 31 23:52:53 GMT 2024 - 4.4K bytes - Viewed (0) -
docs/en/docs/how-to/async-sql-encode-databases.md
"completed": False, } ``` but it doesn't have the `id` field. So we create a new `dict`, that contains the key-value pairs from `note.dict()` with: ```Python {**note.dict()} ``` `**note.dict()` "unpacks" the key value pairs directly, so, `{**note.dict()}` would be, more or less, a copy of `note.dict()`. And then, we extend that copy `dict`, adding another key-value pair: `"id": last_record_id`: ```Python
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 5.3K bytes - Viewed (0) -
docs/en/docs/how-to/conditional-openapi.md
For example: ```Python hl_lines="6 11" {!../../../docs_src/conditional_openapi/tutorial001.py!} ``` Here we declare the setting `openapi_url` with the same default of `"/openapi.json"`. And then we use it when creating the `FastAPI` app. Then you could disable OpenAPI (including the UI docs) by setting the environment variable `OPENAPI_URL` to the empty string, like:
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Aug 19 19:54:04 GMT 2023 - 2.3K bytes - Viewed (0) -
tests/test_webhooks_security.py
start_date: datetime @app.webhooks.post("new-subscription") def new_subscription( body: Subscription, token: Annotated[str, Security(bearer_scheme)] ): """ When a new user subscribes to your service we'll send you a POST request with this data to the URL that you register for the event `new-subscription` in the dashboard. """ client = TestClient(app) def test_dummy_webhook():
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Oct 20 09:00:44 GMT 2023 - 4.6K bytes - Viewed (0)