4.4 KiB
➡ 🔢 & 🔢 🔬
🎏 🌌 👈 👆 💪 📣 🌅 🔬 & 🗃 🔢 🔢 ⏮️ Query
, 👆 💪 📣 🎏 🆎 🔬 & 🗃 ➡ 🔢 ⏮️ Path
.
🗄 ➡
🥇, 🗄 Path
⚪️➡️ fastapi
:
=== "🐍 3️⃣.6️⃣ & 🔛"
```Python hl_lines="3"
{!> ../../../docs_src/path_params_numeric_validations/tutorial001.py!}
```
=== "🐍 3️⃣.1️⃣0️⃣ & 🔛"
```Python hl_lines="1"
{!> ../../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
```
📣 🗃
👆 💪 📣 🌐 🎏 🔢 Query
.
🖼, 📣 title
🗃 💲 ➡ 🔢 item_id
👆 💪 🆎:
=== "🐍 3️⃣.6️⃣ & 🔛"
```Python hl_lines="10"
{!> ../../../docs_src/path_params_numeric_validations/tutorial001.py!}
```
=== "🐍 3️⃣.1️⃣0️⃣ & 🔛"
```Python hl_lines="8"
{!> ../../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
```
!!! note ➡ 🔢 🕧 ✔ ⚫️ ✔️ 🍕 ➡.
, 👆 🔜 📣 ⚫️ ⏮️ `...` ™ ⚫️ ✔.
👐, 🚥 👆 📣 ⚫️ ⏮️ `None` ⚖️ ⚒ 🔢 💲, ⚫️ 🔜 🚫 📉 🕳, ⚫️ 🔜 🕧 🚚.
✔ 🔢 👆 💪
➡️ 💬 👈 👆 💚 📣 🔢 🔢 q
✔ str
.
& 👆 🚫 💪 📣 🕳 🙆 👈 🔢, 👆 🚫 🤙 💪 ⚙️ Query
.
✋️ 👆 💪 ⚙️ Path
item_id
➡ 🔢.
🐍 🔜 😭 🚥 👆 🚮 💲 ⏮️ "🔢" ⏭ 💲 👈 🚫 ✔️ "🔢".
✋️ 👆 💪 🏤-✔ 👫, & ✔️ 💲 🍵 🔢 (🔢 🔢 q
) 🥇.
⚫️ 🚫 🤔 FastAPI. ⚫️ 🔜 🔍 🔢 👫 📛, 🆎 & 🔢 📄 (Query
, Path
, ♒️), ⚫️ 🚫 💅 🔃 ✔.
, 👆 💪 📣 👆 🔢:
{!../../../docs_src/path_params_numeric_validations/tutorial002.py!}
✔ 🔢 👆 💪, 🎱
🚥 👆 💚 📣 q
🔢 🔢 🍵 Query
🚫 🙆 🔢 💲, & ➡ 🔢 item_id
⚙️ Path
, & ✔️ 👫 🎏 ✔, 🐍 ✔️ 🐥 🎁 ❕ 👈.
🚶♀️ *
, 🥇 🔢 🔢.
🐍 🏆 🚫 🕳 ⏮️ 👈 *
, ✋️ ⚫️ 🔜 💭 👈 🌐 📄 🔢 🔜 🤙 🇨🇻 ❌ (🔑-💲 👫), 💭 kwargs
. 🚥 👫 🚫 ✔️ 🔢 💲.
{!../../../docs_src/path_params_numeric_validations/tutorial003.py!}
🔢 🔬: 👑 🌘 ⚖️ 🌓
⏮️ Query
& Path
(& 🎏 👆 🔜 👀 ⏪) 👆 💪 📣 🔢 ⚛.
📥, ⏮️ ge=1
, item_id
🔜 💪 🔢 🔢 "g
🅾 🌘 ⚖️ e
🅾" 1
.
{!../../../docs_src/path_params_numeric_validations/tutorial004.py!}
🔢 🔬: 🌘 🌘 & 🌘 🌘 ⚖️ 🌓
🎏 ✔:
gt
:g
🅾t
👲le
:l
👭 🌘 ⚖️e
🅾
{!../../../docs_src/path_params_numeric_validations/tutorial005.py!}
🔢 🔬: 🎈, 🌘 🌘 & 🌘 🌘
🔢 🔬 👷 float
💲.
📥 🌐❔ ⚫️ ▶️️ ⚠ 💪 📣 gt
& 🚫 ge
. ⏮️ ⚫️ 👆 💪 🚚, 🖼, 👈 💲 🔜 👑 🌘 0
, 🚥 ⚫️ 🌘 🌘 1
.
, 0.5
🔜 ☑ 💲. ✋️ 0.0
⚖️ 0
🔜 🚫.
& 🎏 lt
.
{!../../../docs_src/path_params_numeric_validations/tutorial006.py!}
🌃
⏮️ Query
, Path
(& 🎏 👆 🚫 👀) 👆 💪 📣 🗃 & 🎻 🔬 🎏 🌌 ⏮️ 🔢 🔢 & 🎻 🔬{.internal-link target=_blank}.
& 👆 💪 📣 🔢 🔬:
gt
:g
🅾t
👲ge
:g
🅾 🌘 ⚖️e
🅾lt
:l
👭t
👲le
:l
👭 🌘 ⚖️e
🅾
!!! info
Query
, Path
, & 🎏 🎓 👆 🔜 👀 ⏪ 🏿 ⚠ Param
🎓.
🌐 👫 💰 🎏 🔢 🌖 🔬 & 🗃 👆 ✔️ 👀.
!!! note "📡 ℹ"
🕐❔ 👆 🗄 Query
, Path
& 🎏 ⚪️➡️ fastapi
, 👫 🤙 🔢.
👈 🕐❔ 🤙, 📨 👐 🎓 🎏 📛.
, 👆 🗄 `Query`, ❔ 🔢. & 🕐❔ 👆 🤙 ⚫️, ⚫️ 📨 👐 🎓 🌟 `Query`.
👫 🔢 📤 (↩️ ⚙️ 🎓 🔗) 👈 👆 👨🎨 🚫 ™ ❌ 🔃 👫 🆎.
👈 🌌 👆 💪 ⚙️ 👆 😐 👨🎨 & 🛠️ 🧰 🍵 ✔️ 🚮 🛃 📳 🤷♂ 📚 ❌.