fastapi/docs/em/docs/tutorial/path-operation-configuratio...

5.3 KiB
Raw Blame History

🛠️ 📳

📤 📚 🔢 👈 👆 💪 🚶‍♀️ 👆 🛠️ 👨‍🎨 🔗 .

!!! warning 👀 👈 👫 🔢 🚶‍♀️ 🔗 🛠️ 👨‍🎨, 🚫 👆 🛠️ 🔢.

📨 👔 📟

👆 💪 🔬 (🇺🇸🔍) status_code ⚙️ 📨 👆 🛠️.

👆 💪 🚶‍♀️ 🔗 int 📟, 💖 404.

🚥 👆 🚫 💭 🔠 🔢 📟, 👆 💪 ⚙️📉 status:

=== "🐍 3.6 & 🔛"

```Python hl_lines="3  17"
{!> ../../../docs_src/path_operation_configuration/tutorial001.py!}
```

=== "🐍 3.9 & 🔛"

```Python hl_lines="3  17"
{!> ../../../docs_src/path_operation_configuration/tutorial001_py39.py!}
```

=== "🐍 3.10 & 🔛"

```Python hl_lines="1  15"
{!> ../../../docs_src/path_operation_configuration/tutorial001_py310.py!}
```

👈 👔 📟 🔜 ⚙️ 📨 & 🔜 🚮 🗄 🔗.

!!! note "📡 " 👆 💪 ⚙️ from starlette import status.

**FastAPI** 🚚 🎏 `starlette.status` `fastapi.status` 🏪 👆, 👩‍💻. ✋️ ⚫️ 👟 🔗 ⚪️➡️ 💃.

🔖

👆 💪 🚮 🔖 👆 🛠️, 🚶‍♀️ 🔢 tags ⏮️ list str (🛎 1 str):

=== "🐍 3.6 & 🔛"

```Python hl_lines="17  22  27"
{!> ../../../docs_src/path_operation_configuration/tutorial002.py!}
```

=== "🐍 3.9 & 🔛"

```Python hl_lines="17  22  27"
{!> ../../../docs_src/path_operation_configuration/tutorial002_py39.py!}
```

=== "🐍 3.10 & 🔛"

```Python hl_lines="15  20  25"
{!> ../../../docs_src/path_operation_configuration/tutorial002_py310.py!}
```

👫 🔜 🚮 🗄 🔗 & ⚙️ 🏧 🧾 🔢:

🔖 ⏮️ 🔢

🚥 👆 ✔️ 🦏 🈸, 👆 5📆 🔚 🆙 📈 📚 🔖, & 👆 🔜 💚💭 👆 🕧 ⚙️ 🎏 🔖 🔗 🛠️.

👫 💼, 💪🔑 🏪 🔖 Enum.

FastAPI 🐕‍🦺 👈 🎏 🌌 ⏮️ 🎻:

{!../../../docs_src/path_operation_configuration/tutorial002b.py!}

📄 & 📛

👆 💪 🚮 summary & description:

=== "🐍 3.6 & 🔛"

```Python hl_lines="20-21"
{!> ../../../docs_src/path_operation_configuration/tutorial003.py!}
```

=== "🐍 3.9 & 🔛"

```Python hl_lines="20-21"
{!> ../../../docs_src/path_operation_configuration/tutorial003_py39.py!}
```

=== "🐍 3.10 & 🔛"

```Python hl_lines="18-19"
{!> ../../../docs_src/path_operation_configuration/tutorial003_py310.py!}
```

📛 ➡️ #️⃣

📛 😑 📏 & 📔 💗 ⏸, 👆 💪 📣 🛠️ 📛 🔢 #️⃣ & FastAPI 🔜 ➡️ 📤.

👆 💪 #️⃣ , 🔜 🔬 & 🖥 ☑ ( 🔘 🏧 #️⃣ 📐).

=== "🐍 3.6 & 🔛"

```Python hl_lines="19-27"
{!> ../../../docs_src/path_operation_configuration/tutorial004.py!}
```

=== "🐍 3.9 & 🔛"

```Python hl_lines="19-27"
{!> ../../../docs_src/path_operation_configuration/tutorial004_py39.py!}
```

=== "🐍 3.10 & 🔛"

```Python hl_lines="17-25"
{!> ../../../docs_src/path_operation_configuration/tutorial004_py310.py!}
```

🔜 ⚙️ 🎓 🩺:

📨 📛

👆 💪📨 📛 ⏮️ 🔢 response_description:

=== "🐍 3.6 & 🔛"

```Python hl_lines="21"
{!> ../../../docs_src/path_operation_configuration/tutorial005.py!}
```

=== "🐍 3.9 & 🔛"

```Python hl_lines="21"
{!> ../../../docs_src/path_operation_configuration/tutorial005_py39.py!}
```

=== "🐍 3.10 & 🔛"

```Python hl_lines="19"
{!> ../../../docs_src/path_operation_configuration/tutorial005_py310.py!}
```

!!! info 👀 👈 response_description 🔗 🎯 📨, description 🔗 🛠️ 🏢.

!!! check 🗄 ✔ 👈 🔠 🛠️ 🚚 📨 📛.

, 🚥 👆 🚫 🚚 1⃣, **FastAPI** 🔜 🔁 🏗 1⃣ "🏆 📨".

😢 🛠️

🚥 👆 💪🛠️ 😢, 🍵 , 🚶‍♀️ 🔢 deprecated:

{!../../../docs_src/path_operation_configuration/tutorial006.py!}

🔜 🎯😢 🎓 🩺:

😢 & 🚫-😢 🛠️ 👀 💖:

🌃

👆 💪 🔗 & 🚮 🗃 👆 🛠️ 💪 🚶‍♀️ 🔢 🛠️ 👨‍🎨.