Building A Simple REST API with FastAPI in Python

preview_player
Показать описание
Today we learn how to quickly and easily build a simple REST API in Python using FastAPI.

◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
📚 Programming Books & Merch 📚

🌐 Social Media & Contact 🌐

Рекомендации по теме
Комментарии
Автор

Man, exactly what I was looking for. Implemented what I wanted in 5 minutes "while" watching your video! Thanks heaps!

zlcksuasdv
Автор

Great tutorial, Thank you so much. I feel so confident in REST API now :)

apraveena
Автор

Great tutorial man, im grateful for your work here. Really concise vid.

FreakyStyleytobby
Автор

amazing tutorial👏👏. It has helped me understand a lot about fastapi. cheers mate🥂

jacobwilsonmwale
Автор

I there!!! Great videos and great work. Just dropping suggestion of similar video with Django Rest library

pedromiranda
Автор

i liked the tutorial but i think some of the code coulda been more thought through, like adding proper guard clauses, doctsrings and less ugly id usage 😅😅

andrewmenshicov
Автор

Thanks for the great explanation. I have one question. Imagine I have the data and the API code on a raspberry pi as a server. How can I give a client access to it over the internet? I mean, I need the client to be able for example to fetch data (get) either using the header method or preferrably the FastAPI's documentation interface that you showed here. Thanks

Sam-tgii
Автор

I believe that you didn't consider problem with ID after deletion. If you remove something from the middle you will get bad indexes. Anyway thx for this video I find it's really useful.

dbugtro
Автор

Hi! can you plz help to use postgres for data for the same

vikashvashishat
Автор

does anyone know if there is a way to take the ID out of the sample when you "Try It out" since we are not assigning it back. I find it pretty confusing.

hfrog
Автор

i see your json file has been changed when you do add_person() part. I think you should change the code where you call people, you have to change it to people["people"] .

buixuanhung
Автор

is that a chrome extension for your json viewing?

hfrog
Автор

How about of make this api asynchronous? Is there any video you could recommend?

gxmz
Автор

Also, for everyone....

Is there not a more efficient way of doing this?

def search_provider(accepting: Optional[int] = Query(None, title="Accepting", description="Is the Doctor accepting new patients?"),
gender: Optional[str] = Query(None, title="Gender", description="Gender of the Doctor")):
accepting_providers = [p for p in providers if accepting.lower() == p['accepting']]
if gender is None:
if accepting is None:
return providers
else:
return accepting_providers
else:
gendered_providers = [p for p in providers if gender.lower() in p['gender']]
if accepting is None:
return gendered_providers
else:
combined_condition = [p for p in accepting_providers if p in gendered_providers]

hfrog
Автор

just in case anyone's getting a TypeError: Object of type Person is not JSON serializable at add_person(), you need to do this json.dump(dict(people), f)

sushmita
Автор

Fix for add_person():
...
people.append(new_person)
people_write = {"people": people}
with open("people.json", "w") as f:
json.dump(people_write, f)

Nicolas_Rangel