5.3 KiB
➡ 🛠️ 📳
📤 📚 🔢 👈 👆 💪 🚶♀️ 👆 ➡ 🛠️ 👨🎨 🔗 ⚫️.
!!! 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️⃣.1️⃣0️⃣ & 🔛"
```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️⃣.1️⃣0️⃣ & 🔛"
```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️⃣.1️⃣0️⃣ & 🔛"
```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️⃣.1️⃣0️⃣ & 🔛"
```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️⃣.1️⃣0️⃣ & 🔛"
```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!}
⚫️ 🔜 🎯 ™ 😢 🎓 🩺:

✅ ❔ 😢 & 🚫-😢 ➡ 🛠️ 👀 💖:

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