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")
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.
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
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.
@@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?
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?
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.
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
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.
Nice call out! Thanks :-)
I loved your explanation , it was so precise
Woot woot - thank you 🙂
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!
I am glad you were able to do your project in time!
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
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.
@@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?
@@Frangelo90 Oh yeah, FastAPI can definitely do what you want complete!
VERY NICE , WITH A GOOD EXPLANATIONS , THINK YOU
Glad it was able to help you :-)
Can you make a SQLModel video with
Select where(single, multiple condition), joins, etc???
I sure can! I will be adding new videos.
@@codingwithroby subscribed and clicked the notification!
Good explainations bravo !!
Thanks!
This takes same book multiple times. How to resolve this
Great tutorial!
Glad you think so!
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?
That is just what Swagger does. You can change it on each request.
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.
For while, I thought that you will talk about Ruby on rails 😂
haha why is that?
@@codingwithroby you said coding with roby, I am new to the channel 😅
Ahh, I understand lol
I have an OCR python program and i want to use it in my electron project can i ?
I wouldn't see why not :-)
Was swagger renamed OpenAPI?
Swagger is the actual tool, OpenAPI is the specification in which it follows :)
@@codingwithroby you the 👑
Can't wait to go through your content this weekend!
Only http ?
You mean versus HTTPS?