Modern APIs with FastAPI and Python Transcripts
Chapter: Building a realistic API
Lecture: Introducing our main API

Login or purchase this course to watch this video and the rest of the course contents.
0:00 We've played around a little bit with FastAPI. We built a simple calculator
0:04 API and we looked at all the language foundations.
0:06 Now it's time to build a realistic,
0:09 legitimate API that talks to other services, that does high performance things, that
0:14 takes advantage of all those language features we talked about.
0:17 So, what are we gonna build?
0:19 How about something on the Internet that is real time,
0:22 like weather? So we're gonna build this web application here.
0:27 You see, it actually has a Web page as well as the underlying
0:30 API. The idea is we're gonna be able to enter our location, either just by city
0:35 or potentially with country or a state,
0:38 and get back some kind of report in
0:40 however we ask. So, if we ask for the weather in Portland,
0:44 Oregon, or Portland, United States,
0:46 we'll get it back in Portland,
0:47 Oregon, and we'll get legitimate real-time weather from somewhere on the Internet to be
0:53 determined. So this is what we're gonna build,
0:55 and we're going to focus on a couple of iterations of making this nicer and nicer.
0:58 Where will we get the data?
1:00 Well, "openweathermap.org".
1:03 This is a super cool website.
1:05 They have a free tier. I believe you get to do one million requests per
1:10 day, but you can only do something like 60 requests a minute.
1:13 So it's, for the free version.
1:15 So it's not completely open ended,
1:17 but for our example, what we're trying to do, this is gonna completely be fine.
1:20 So what you'll need to do is log in over here and get an API
1:24 key as part of this. But there's nothing to buy,
1:27 nothing to do and yeah,
1:29 we'll set it up so we'll consume this weather data,
1:32 pull it back, make some changes to it,
1:34 makes some adjustments to it and then return that to our users.
1:37 We could also save stuff to a database, do logging, all sorts of things,
1:41 but the main part is just gonna be focusing on consuming an external API.
1:45 You know, think of this as an example of micro services or credit
1:49 card purchases, or even talking to a database, like something external that we get to
1:54 talk to that will allow us to scale our Web app using some of the cool
1:57 async and await features and so on.
1:59 So this is what we're gonna build, this weather service,
2:01 and we're gonna back it with data coming from the openweathermap.org API.