Build a Simple API from Scratch 💻 FastAPI Tutorial for Beginner
Автор: Python Simplified
Загружено: 2025-09-07
Просмотров: 71952
What if APIs are not confusing at all - they were just never explained simply enough? 🤯
In this beginner-friendly FastAPI tutorial, we’ll build a simple API from scratch with Python — using a fun real-world example of delivering goods from New Jersey to New York! 🚚🍅
By the end of this tutorial, you’ll not only understand what APIs are, but you’ll also design, develop, and run one yourself - complete with custom endpoints, async requests, error handling, and even a beautiful client app that brings your API to life! No boring backends, no overwhelming syntax! Just the simplest introduction you’ve ever seen. 😎
⭐ This video is brought to you by HubSpot! Check out their FREE Introduction to Python PDF guide: https://clickhubspot.com/f057c8
Big thanks to HubSpot for sponsoring this video and providing the Python guide for free! 🙌
📚 What you'll learn:
What APIs are and how they work (explained with trucks, bridges & tomatoes!)
How to build an API server with FastAPI
Creating endpoints and path parameters
Handling multiple requests (async functions)
Using query parameters (`?order_qty=30`)
Updating inventory dynamically
Error handling & best practices with FastAPI
Running and testing your API with Uvicorn
Connecting to a custom-built client app
🛠️ Tools used:
Conda / WSL
FastAPI
Uvicorn
Custom FastAPI client app
🔎 Resources & Helpful Tutorials:
--------------------------------------------
⭐ Full code on GitHub: https://github.com/MariyaSha/Simple_A...
⭐ Free Python Introduction PDF (HubSpot): https://clickhubspot.com/f057c8
⭐ Install WSL and Conda: • My Go-To Python Setup! 🐍 WSL + Conda Minif...
💻 Environment Setup:
-----------------------------------------------------------------------------------------------
conda create -n api_env python=3.12
conda activate api_env
pip install fastapi uvicorn
Run API server :
uvicorn nj_server:app --reload
Run my custom client:
pip install requests jinja2 python-multipart
uvicorn ny_client:app --reload --port 8001
⚙️ Example Endpoint:
-----------------------------------------------------------------------------------------------
@app.get("/warehouse/{my_item}")
async def load_truck(my_item, order_qty):
return {
"item": my_item,
"order_qty": order_qty,
"unit": catalog[my_item]["unit"]
}
-----------------------------------------------------------------------------------------------
⏰ Timestamps ⏰
01:22 - What is an API? (Explained with trucks & bridges)
03:35 - Coding an API Server with FastAPI
06:02 - Creating Endpoints
08:10 - Async Functions
08:42 - Path Parameters
09:45 - Running the API Server with Uvicorn
13:17 - Custom Client App
16:15 - Updating Inventory Dynamically
19:03 - Error Handling in FastAPI
20:15 - Best Practices & Next Steps
21:26 - Thanks for Watching! :)
#python #api #programming #coding #pythonprogramming #pythontutorial #backend #webdevelopment #beginnerfriendly #server #client
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: