Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 2 additions & 58 deletions docs/en/docs/tutorial/request-forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,69 +18,13 @@ $ pip install python-multipart

Import `Form` from `fastapi`:

//// tab | Python 3.9+

```Python hl_lines="3"
{!> ../../docs_src/request_forms/tutorial001_an_py39.py!}
```

////

//// tab | Python 3.8+

```Python hl_lines="1"
{!> ../../docs_src/request_forms/tutorial001_an.py!}
```

////

//// tab | Python 3.8+ non-Annotated

/// tip

Prefer to use the `Annotated` version if possible.

///

```Python hl_lines="1"
{!> ../../docs_src/request_forms/tutorial001.py!}
```

////
{* ../../docs_src/request_forms/tutorial001_an_py39.py hl[3] *}

## Define `Form` parameters

Create form parameters the same way you would for `Body` or `Query`:

//// tab | Python 3.9+

```Python hl_lines="9"
{!> ../../docs_src/request_forms/tutorial001_an_py39.py!}
```

////

//// tab | Python 3.8+

```Python hl_lines="8"
{!> ../../docs_src/request_forms/tutorial001_an.py!}
```

////

//// tab | Python 3.8+ non-Annotated

/// tip

Prefer to use the `Annotated` version if possible.

///

```Python hl_lines="7"
{!> ../../docs_src/request_forms/tutorial001.py!}
```

////
{* ../../docs_src/request_forms/tutorial001_an_py39.py hl[9] *}

For example, in one of the ways the OAuth2 specification can be used (called "password flow") it is required to send a `username` and `password` as form fields.

Expand Down