-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into yoruba-translation-docs
- Loading branch information
Showing
10 changed files
with
1,361 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,5 @@ logins: | |
- databento-bot | ||
- nanram22 | ||
- Flint-company | ||
- porter-dev | ||
- fern-api |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# Параметри Cookie | ||
|
||
Ви можете визначити параметри Cookie таким же чином, як визначаються параметри `Query` і `Path`. | ||
|
||
## Імпорт `Cookie` | ||
|
||
Спочатку імпортуйте `Cookie`: | ||
|
||
=== "Python 3.10+" | ||
|
||
```Python hl_lines="3" | ||
{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!} | ||
``` | ||
|
||
=== "Python 3.9+" | ||
|
||
```Python hl_lines="3" | ||
{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!} | ||
``` | ||
|
||
=== "Python 3.6+" | ||
|
||
```Python hl_lines="3" | ||
{!> ../../../docs_src/cookie_params/tutorial001_an.py!} | ||
``` | ||
|
||
=== "Python 3.10+ non-Annotated" | ||
|
||
!!! tip | ||
Бажано використовувати `Annotated` версію, якщо це можливо. | ||
|
||
```Python hl_lines="1" | ||
{!> ../../../docs_src/cookie_params/tutorial001_py310.py!} | ||
``` | ||
|
||
=== "Python 3.6+ non-Annotated" | ||
|
||
!!! tip | ||
Бажано використовувати `Annotated` версію, якщо це можливо. | ||
|
||
```Python hl_lines="3" | ||
{!> ../../../docs_src/cookie_params/tutorial001.py!} | ||
``` | ||
|
||
## Визначення параметрів `Cookie` | ||
|
||
Потім визначте параметри cookie, використовуючи таку ж конструкцію як для `Path` і `Query`. | ||
|
||
Перше значення це значення за замовчуванням, ви можете також передати всі додаткові параметри валідації чи анотації: | ||
|
||
=== "Python 3.10+" | ||
|
||
```Python hl_lines="9" | ||
{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!} | ||
``` | ||
|
||
=== "Python 3.9+" | ||
|
||
```Python hl_lines="9" | ||
{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!} | ||
``` | ||
|
||
=== "Python 3.6+" | ||
|
||
```Python hl_lines="10" | ||
{!> ../../../docs_src/cookie_params/tutorial001_an.py!} | ||
``` | ||
|
||
=== "Python 3.10+ non-Annotated" | ||
|
||
!!! tip | ||
Бажано використовувати `Annotated` версію, якщо це можливо. | ||
|
||
```Python hl_lines="7" | ||
{!> ../../../docs_src/cookie_params/tutorial001_py310.py!} | ||
``` | ||
|
||
=== "Python 3.6+ non-Annotated" | ||
|
||
!!! tip | ||
Бажано використовувати `Annotated` версію, якщо це можливо. | ||
|
||
```Python hl_lines="9" | ||
{!> ../../../docs_src/cookie_params/tutorial001.py!} | ||
``` | ||
|
||
!!! note "Технічні Деталі" | ||
`Cookie` це "сестра" класів `Path` і `Query`. Вони наслідуються від одного батьківського класу `Param`. | ||
Але пам'ятайте, що коли ви імпортуєте `Query`, `Path`, `Cookie` та інше з `fastapi`, це фактично функції, що повертають спеціальні класи. | ||
|
||
!!! info | ||
Для визначення cookies ви маєте використовувати `Cookie`, тому що в іншому випадку параметри будуть інтерпритовані, як параметри запиту. | ||
|
||
## Підсумки | ||
|
||
Визначайте cookies за допомогою `Cookie`, використовуючи той же спільний шаблон, що і `Query` та `Path`. |
Oops, something went wrong.