Python FastAPI Tutorial: How to build modern RESTful APIs with Python

  Рет қаралды 12,557

Eric Roby

Eric Roby

Күн бұрын

In this Python video tutorial you will dive into FastAPI, a web framework for developing modern RESTful APIs using Python. FastAPI is built off of Starlette and Pydantic, therefore the performance of FastAPI is off the charts. Pydantic allows type hints to perform data validation and serialization / deserialization of data. FastAPI automatically creates interactive Swagger UI documentation which is perfect for any developer.
🎓 Check these out 🎓
===========================================
✔️ Subscribe to Codingwithroby : / @codingwithroby
🎓 Courses can be found:
FastAPI Beginner & Advanced: www.udemy.com/course/fastapi-...
Learn Chatbot Development: www.udemy.com/course/the-comp...
💻 GitHub Repo 💻
* Follow README to get started *
www.codingwithroby.io/get-rep...
⭐ Timestamps ⭐
===========================================
00:00 - Intro
02:42 - IDE and Virtual ENV setup
05:46 - Install FastAPI and Uvicorn
07:38 - Writing first RESTful API
08:42 - Starting FastAPI Application
10:00 - Swagger UI Docs
11:10 - Path Parameters
12:17 - Pydantic and Models
16:33 - POST Request Method
23:23 - PUT Request Method
24:50 - HTTP Exceptions
26:00 - DELETE Request Method
27:00 - Put it all together
⭐️ Hashtags ⭐️
#codingwithroby #FastAPITutorial

Пікірлер: 29
@rstiekema
@rstiekema 22 күн бұрын
awesome tutorial. I wouldn't use a for-loop btw. Rather use something like: # Find the index of the item to delete item_index = next((index for (index, d) in enumerate(books) if d.id == book_id), None) # Check if book exists if item_index is None: raise HTTPException(status_code=404, detail=f"Id {book_id} does not exist") books[item_index] = book return book
@user-tl6yl1fp9x
@user-tl6yl1fp9x Жыл бұрын
Great tutorial! i needed exactly those two videos for my project dwo tommorow, and i had no hope on finishing it on time... thank you very very much!
@codingwithroby
@codingwithroby Жыл бұрын
I am glad you were able to do your project in time!
@waldschratler
@waldschratler Жыл бұрын
Very good tutorial! For PUT (update) and DELETE you can use "for i, x in enumerate(BOOKS):" instead of the counter and then use "i" as the index e.g. del BOOKS[i]. "enumerate" automatically counts for you in a for loop. It's a bit cleaner than using a counter.
@codingwithroby
@codingwithroby Жыл бұрын
Nice call out! Thanks :-)
@ramdanebachir9659
@ramdanebachir9659 Жыл бұрын
VERY NICE , WITH A GOOD EXPLANATIONS , THINK YOU
@codingwithroby
@codingwithroby Жыл бұрын
Glad it was able to help you :-)
@marcgold424
@marcgold424 2 жыл бұрын
Great tutorial!
@codingwithroby
@codingwithroby Жыл бұрын
Glad you think so!
@TheNovaManagement
@TheNovaManagement 4 ай бұрын
Good explainations bravo !!
@codingwithroby
@codingwithroby 4 ай бұрын
Thanks!
@checkmate7780
@checkmate7780 Жыл бұрын
Hi Roby, Just a doubt.. Why the same UUID is showing for every item posted. Why do we need to manually change the same? Can't it be uniquely generated?
@codingwithroby
@codingwithroby Жыл бұрын
That is just what Swagger does. You can change it on each request.
@larrybowers45
@larrybowers45 Ай бұрын
To auto-generate the ID, you can update the id field definition in the class to this: id: UUID = Field(default_factory=uuid4) You also need to import uuid4: from uuid import UUID, uuid4 You will notice when you look at the swagger doc, that 'id' is no longer a required field and the id has been automatically generated in the POST response.
@chriskeo392
@chriskeo392 2 жыл бұрын
Can you make a SQLModel video with Select where(single, multiple condition), joins, etc???
@codingwithroby
@codingwithroby 2 жыл бұрын
I sure can! I will be adding new videos.
@chriskeo392
@chriskeo392 2 жыл бұрын
@@codingwithroby subscribed and clicked the notification!
@Frangelo90
@Frangelo90 Жыл бұрын
Hello couple of questions about your course... -Can it teach me how to get requests from commercial APIs and store them to a database? -Does it teach about custom styling the API data on the front end? -Does it teach at least some JavaScript DOM manipulation or event listeners? I'm interested on playing around different public APIs and display them on the browser with custom styling and click events. Thanks
@codingwithroby
@codingwithroby Жыл бұрын
Hey friend! It does not show those things unfortunately. It is 100% focused on getting someone from beginner to advanced topics. It will cover many things about FastAPI (Request Methods, Authentication, Authorization, JWTs, Security, status codes, responses, data validation, and a ton more!) but does not go over too much JavaScript, or how to communicate with different APIs from different applications.
@Frangelo90
@Frangelo90 Жыл бұрын
@@codingwithroby Thanks for the response! I guess the better question is can FastAPI in general able to do what I want to do? I'm looking at your other videos and it seems it's possible I just need to stich them together. Or should I just go with another framework?
@codingwithroby
@codingwithroby Жыл бұрын
@@Frangelo90 Oh yeah, FastAPI can definitely do what you want complete!
@samianisbouchbout7185
@samianisbouchbout7185 2 жыл бұрын
I have an OCR python program and i want to use it in my electron project can i ?
@codingwithroby
@codingwithroby Жыл бұрын
I wouldn't see why not :-)
@bharathchandrapanasa7997
@bharathchandrapanasa7997 5 ай бұрын
This takes same book multiple times. How to resolve this
@chriskeo392
@chriskeo392 2 жыл бұрын
Was swagger renamed OpenAPI?
@codingwithroby
@codingwithroby 2 жыл бұрын
Swagger is the actual tool, OpenAPI is the specification in which it follows :)
@chriskeo392
@chriskeo392 2 жыл бұрын
@@codingwithroby you the 👑 Can't wait to go through your content this weekend!
@gold-junge91
@gold-junge91 2 ай бұрын
Only http ?
@codingwithroby
@codingwithroby 2 ай бұрын
You mean versus HTTPS?
Python FastAPI Tutorial: How to Connect FastAPI to Database
26:11
Why You NEED To Learn FastAPI | Hands On Project
21:15
Travis Media
Рет қаралды 153 М.
That's how money comes into our family
00:14
Mamasoboliha
Рет қаралды 10 МЛН
THEY made a RAINBOW M&M 🤩😳 LeoNata family #shorts
00:49
LeoNata Family
Рет қаралды 35 МЛН
Who has won ?? 😀 #shortvideo #lizzyisaeva
00:24
Lizzy Isaeva
Рет қаралды 61 МЛН
Why McDonald’s, Apple and Other U.S. Brands Are Losing in China | WSJ
6:21
The Wall Street Journal
Рет қаралды 681 М.
How to build a FastAPI app with PostgreSQL
27:37
Eric Roby
Рет қаралды 39 М.
How To Create a Python API With FastAPI - Full Tutorial
25:39
Tech With Tim
Рет қаралды 34 М.
Build an AI app with FastAPI and Docker - Coding Tutorial with Tips
35:18
Python or JavaScript - Which One Should YOU Learn?
8:05
Tech With Tim
Рет қаралды 167 М.
Simulating the Evolution of Rock, Paper, Scissors
15:00
Primer
Рет қаралды 399 М.
That's how money comes into our family
00:14
Mamasoboliha
Рет қаралды 10 МЛН