2.5 KiB
📨 📨 🔗
🕐❔ 👆 ✍ FastAPI ➡ 🛠️ 👆 💪 🛎 📨 🙆 📊 ⚪️➡️ ⚫️: dict
, list
, Pydantic 🏷, 💽 🏷, ♒️.
🔢, FastAPI 🔜 🔁 🗜 👈 📨 💲 🎻 ⚙️ jsonable_encoder
🔬 🎻 🔗 🔢{.internal-link target=_blank}.
⤴️, ⛅ 🎑, ⚫️ 🔜 🚮 👈 🎻-🔗 💽 (✅ dict
) 🔘 JSONResponse
👈 🔜 ⚙️ 📨 📨 👩💻.
✋️ 👆 💪 📨 JSONResponse
🔗 ⚪️➡️ 👆 ➡ 🛠️.
⚫️ 💪 ⚠, 🖼, 📨 🛃 🎚 ⚖️ 🍪.
📨 Response
👐, 👆 💪 📨 🙆 Response
⚖️ 🙆 🎧-🎓 ⚫️.
/// tip
JSONResponse
⚫️ 🎧-🎓 Response
.
///
& 🕐❔ 👆 📨 Response
, FastAPI 🔜 🚶♀️ ⚫️ 🔗.
⚫️ 🏆 🚫 🙆 💽 🛠️ ⏮️ Pydantic 🏷, ⚫️ 🏆 🚫 🗜 🎚 🙆 🆎, ♒️.
👉 🤝 👆 📚 💪. 👆 💪 📨 🙆 📊 🆎, 🔐 🙆 💽 📄 ⚖️ 🔬, ♒️.
⚙️ jsonable_encoder
Response
↩️ FastAPI 🚫 🙆 🔀 Response
👆 📨, 👆 ✔️ ⚒ 💭 ⚫️ 🎚 🔜 ⚫️.
🖼, 👆 🚫🔜 🚮 Pydantic 🏷 JSONResponse
🍵 🥇 🏭 ⚫️ dict
⏮️ 🌐 📊 🆎 (💖 datetime
, UUID
, ♒️) 🗜 🎻-🔗 🆎.
📚 💼, 👆 💪 ⚙️ jsonable_encoder
🗜 👆 📊 ⏭ 🚶♀️ ⚫️ 📨:
{* ../../docs_src/response_directly/tutorial001.py hl[6:7,21:22] *}
/// note | 📡 ℹ
👆 💪 ⚙️ from starlette.responses import JSONResponse
.
FastAPI 🚚 🎏 starlette.responses
fastapi.responses
🏪 👆, 👩💻. ✋️ 🌅 💪 📨 👟 🔗 ⚪️➡️ 💃.
///
🛬 🛃 Response
🖼 🔛 🎦 🌐 🍕 👆 💪, ✋️ ⚫️ 🚫 📶 ⚠, 👆 💪 ✔️ 📨 item
🔗, & FastAPI 🔜 🚮 ⚫️ JSONResponse
👆, 🏭 ⚫️ dict
, ♒️. 🌐 👈 🔢.
🔜, ➡️ 👀 ❔ 👆 💪 ⚙️ 👈 📨 🛃 📨.
➡️ 💬 👈 👆 💚 📨 📂 📨.
👆 💪 🚮 👆 📂 🎚 🎻, 🚮 ⚫️ Response
, & 📨 ⚫️:
{* ../../docs_src/response_directly/tutorial002.py hl[1,18] *}
🗒
🕐❔ 👆 📨 Response
🔗 🚮 📊 🚫 ✔, 🗜 (🎻), 🚫 📄 🔁.
✋️ 👆 💪 📄 ⚫️ 🔬 🌖 📨 🗄{.internal-link target=_blank}.
👆 💪 👀 ⏪ 📄 ❔ ⚙️/📣 👉 🛃 Response
Ⓜ ⏪ ✔️ 🏧 💽 🛠️, 🧾, ♒️.