Modern APIs with FastAPI and Python Transcripts
Chapter: Course conclusion and review
Lecture: Review: async view methods

Login or purchase this course to watch this video and the rest of the course contents.
0:00 One of the most important things we can do for scalability and making our Web servers
0:04 handle more traffic with less hardware is to take the times where we're waiting on external
0:09 services and allow other code to run.
0:11 Whether that's waiting on a deep database server to get back to us,
0:14 calling an external API and waiting around for it to get back to us,
0:18 the ping time as stuff travels through the Internet and connecting all those different things.
0:23 So we saw that FastAPI
0:25 natively supports async methods.
0:28 It makes it super easy for us to work with them.
0:31 So here to convert our weather
0:33 API call to an async call,
0:35 we just put the word async def instead of def to define the function.
0:38 And then when we call any async operations like get report
0:41 async, we just use the word await in front of it.
0:44 That's it. Now we've gained tons of scalability by allowing the processing of other requests
0:49 while we're waiting on the report to come back to us.