⚒¶
FastAPI ⚒¶
FastAPI 🤝 👆 📄:
⚓️ 🔛 📂 🐩¶
- 🗄 🛠️ 🏗, ✅ 📄 ➡ 🛠️, 🔢, 💪 📨, 💂♂, ♒️.
- 🏧 📊 🏷 🧾 ⏮️ 🎻 🔗 (🗄 ⚫️ 🧢 🔛 🎻 🔗).
- 🔧 🤭 👫 🐩, ⏮️ 😔 🔬. ↩️ 👎 🧽 🔛 🔝.
- 👉 ✔ ⚙️ 🏧 👩💻 📟 ⚡ 📚 🇪🇸.
🏧 🩺¶
🎓 🛠️ 🧾 & 🔬 🕸 👩💻 🔢. 🛠️ ⚓️ 🔛 🗄, 📤 💗 🎛, 2️⃣ 🔌 🔢.
- 🦁 🎚, ⏮️ 🎓 🔬, 🤙 & 💯 👆 🛠️ 🔗 ⚪️➡️ 🖥.
- 🎛 🛠️ 🧾 ⏮️ 📄.
🏛 🐍¶
⚫️ 🌐 ⚓️ 🔛 🐩 🐍 3️⃣.6️⃣ 🆎 📄 (👏 Pydantic). 🙅♂ 🆕 ❕ 💡. 🐩 🏛 🐍.
🚥 👆 💪 2️⃣ ⏲ ↗️ ❔ ⚙️ 🐍 🆎 (🚥 👆 🚫 ⚙️ FastAPI), ✅ 📏 🔰: 🐍 🆎.
👆 ✍ 🐩 🐍 ⏮️ 🆎:
from datetime import date
from pydantic import BaseModel
# Declare a variable as a str
# and get editor support inside the function
def main(user_id: str):
return user_id
# A Pydantic model
class User(BaseModel):
id: int
name: str
joined: date
👈 💪 ⤴️ ⚙️ 💖:
my_user: User = User(id=3, name="John Doe", joined="2018-07-19")
second_user_data = {
"id": 4,
"name": "Mary",
"joined": "2018-11-30",
}
my_second_user: User = User(**second_user_data)
Info
**second_user_data
⛓:
🚶♀️ 🔑 & 💲 second_user_data
#️⃣ 🔗 🔑-💲 ❌, 🌓: User(id=4, name="Mary", joined="2018-11-30")
👨🎨 🐕🦺¶
🌐 🛠️ 🏗 ⏩ & 🏋️ ⚙️, 🌐 🚫 💯 🔛 💗 👨🎨 ⏭ ▶️ 🛠️, 🚚 🏆 🛠️ 💡.
🏁 🐍 👩💻 🔬 ⚫️ 🆑 👈 🌅 ⚙️ ⚒ "✍".
🎂 FastAPI 🛠️ ⚓️ 😌 👈. ✍ 👷 🌐.
👆 🔜 🛎 💪 👟 🔙 🩺.
📥 ❔ 👆 👨🎨 💪 ℹ 👆:
- 🗒:
👆 🔜 🤚 🛠️ 📟 👆 5️⃣📆 🤔 💪 ⏭. 🖼, price
🔑 🔘 🎻 💪 (👈 💪 ✔️ 🐦) 👈 👟 ⚪️➡️ 📨.
🙅♂ 🌖 ⌨ ❌ 🔑 📛, 👟 🔙 & ➡ 🖖 🩺, ⚖️ 📜 🆙 & 🔽 🔎 🚥 👆 😒 ⚙️ username
⚖️ user_name
.
📏¶
⚫️ ✔️ 🤔 🔢 🌐, ⏮️ 📦 📳 🌐. 🌐 🔢 💪 👌-🎧 ⚫️❔ 👆 💪 & 🔬 🛠️ 👆 💪.
✋️ 🔢, ⚫️ 🌐 "👷".
🔬¶
-
🔬 🌅 (⚖️ 🌐 ❓) 🐍 💽 🆎, 🔌:
- 🎻 🎚 (
dict
). - 🎻 🎻 (
list
) ⚖ 🏬 🆎. - 🎻 (
str
) 🏑, 🔬 🕙 & 👟 📐. - 🔢 (
int
,float
) ⏮️ 🕙 & 👟 💲, ♒️.
- 🎻 🎚 (
-
🔬 🌅 😍 🆎, 💖:
- 📛.
- 📧.
- 🆔.
- ...& 🎏.
🌐 🔬 🍵 👍-🏛 & 🏋️ Pydantic.
💂♂ & 🤝¶
💂♂ & 🤝 🛠️. 🍵 🙆 ⚠ ⏮️ 💽 ⚖️ 📊 🏷.
🌐 💂♂ ⚖ 🔬 🗄, 🔌:
- 🇺🇸🔍 🔰.
- Oauth2️⃣ (⏮️ 🥙 🤝). ✅ 🔰 🔛 Oauth2️⃣ ⏮️ 🥙.
- 🛠️ 🔑:
- 🎚.
- 🔢 🔢.
- 🍪, ♒️.
➕ 🌐 💂♂ ⚒ ⚪️➡️ 💃 (🔌 🎉 🍪).
🌐 🏗 ♻ 🧰 & 🦲 👈 ⏩ 🛠️ ⏮️ 👆 ⚙️, 📊 🏪, 🔗 & ☁ 💽, ♒️.
🔗 💉¶
FastAPI 🔌 📶 ⏩ ⚙️, ✋️ 📶 🏋️ 🔗 💉 ⚙️.
- 🔗 💪 ✔️ 🔗, 🏗 🔗 ⚖️ "📊" 🔗.
- 🌐 🔁 🍵 🛠️.
- 🌐 🔗 💪 🚚 💽 ⚪️➡️ 📨 & ↔ ➡ 🛠️ ⚛ & 🏧 🧾.
- 🏧 🔬 ➡ 🛠️ 🔢 🔬 🔗.
- 🐕🦺 🏗 👩💻 🤝 ⚙️, 💽 🔗, ♒️.
- 🙅♂ ⚠ ⏮️ 💽, 🕸, ♒️. ✋️ ⏩ 🛠️ ⏮️ 🌐 👫.
♾ "🔌-🔌"¶
⚖️ 🎏 🌌, 🙅♂ 💪 👫, 🗄 & ⚙️ 📟 👆 💪.
🙆 🛠️ 🏗 🙅 ⚙️ (⏮️ 🔗) 👈 👆 💪 ✍ "🔌-" 👆 🈸 2️⃣ ⏸ 📟 ⚙️ 🎏 📊 & ❕ ⚙️ 👆 ➡ 🛠️.
💯¶
- 1️⃣0️⃣0️⃣ 💯 💯 💰.
- 1️⃣0️⃣0️⃣ 💯 🆎 ✍ 📟 🧢.
- ⚙️ 🏭 🈸.
💃 ⚒¶
FastAPI 🍕 🔗 ⏮️ (& ⚓️ 🔛) 💃. , 🙆 🌖 💃 📟 👆 ✔️, 🔜 👷.
FastAPI
🤙 🎧-🎓 Starlette
. , 🚥 👆 ⏪ 💭 ⚖️ ⚙️ 💃, 🌅 🛠️ 🔜 👷 🎏 🌌.
⏮️ FastAPI 👆 🤚 🌐 💃'Ⓜ ⚒ (FastAPI 💃 🔛 💊):
- 🤙 🎆 🎭. ⚫️ 1️⃣ ⏩ 🐍 🛠️ 💪, 🔛 🇷🇪 ⏮️ ✳ & 🚶.
- ** *️⃣ ** 🐕🦺.
- -🛠️ 🖥 📋.
- 🕴 & 🤫 🎉.
- 💯 👩💻 🏗 🔛 🇸🇲.
- ⚜, 🗜, 🎻 📁, 🎏 📨.
- 🎉 & 🍪 🐕🦺.
- 1️⃣0️⃣0️⃣ 💯 💯 💰.
- 1️⃣0️⃣0️⃣ 💯 🆎 ✍ ✍.
Pydantic ⚒¶
FastAPI 🍕 🔗 ⏮️ (& ⚓️ 🔛) Pydantic. , 🙆 🌖 Pydantic 📟 👆 ✔️, 🔜 👷.
✅ 🔢 🗃 ⚓️ 🔛 Pydantic, 🐜Ⓜ, 🏭Ⓜ 💽.
👉 ⛓ 👈 📚 💼 👆 💪 🚶♀️ 🎏 🎚 👆 🤚 ⚪️➡️ 📨 🔗 💽, 🌐 ✔ 🔁.
🎏 ✔ 🎏 🌌 🤭, 📚 💼 👆 💪 🚶♀️ 🎚 👆 🤚 ⚪️➡️ 💽 🔗 👩💻.
⏮️ FastAPI 👆 🤚 🌐 Pydantic'Ⓜ ⚒ (FastAPI ⚓️ 🔛 Pydantic 🌐 💽 🚚):
- 🙅♂ 🔠:
- 🙅♂ 🆕 🔗 🔑 ◾-🇪🇸 💡.
- 🚥 👆 💭 🐍 🆎 👆 💭 ❔ ⚙️ Pydantic.
- 🤾 🎆 ⏮️ 👆 💾/🧶/🧠:
- ↩️ Pydantic 📊 📊 👐 🎓 👆 🔬; 🚘-🛠️, 🧽, ✍ & 👆 🤔 🔜 🌐 👷 ☑ ⏮️ 👆 ✔ 💽.
- ✔ 🏗 📊:
- ⚙️ 🔗 Pydantic 🏷, 🐍
typing
'ⓂList
&Dict
, ♒️. - & 💳 ✔ 🏗 💽 🔗 🎯 & 💪 🔬, ✅ & 📄 🎻 🔗.
- 👆 💪 ✔️ 🙇 🐦 🎻 🎚 & ✔️ 👫 🌐 ✔ & ✍.
- ⚙️ 🔗 Pydantic 🏷, 🐍
- 🏧:
- Pydantic ✔ 🛃 📊 🆎 🔬 ⚖️ 👆 💪 ↔ 🔬 ⏮️ 👩🔬 🔛 🏷 🎀 ⏮️ 💳 👨🎨.
- 1️⃣0️⃣0️⃣ 💯 💯 💰.