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 API and we looked at all the language foundations.
0:07 Now it's time to build a realistic, legitimate API that talks to other services, that does high performance things, that
0:15 takes advantage of all those language features we talked about. So, what are we gonna build? How about something on the Internet that is real time,
0:23 like weather? So we're gonna build this web application here. You see, it actually has a Web page as well as the underlying
0:31 API. The idea is we're gonna be able to enter our location, either just by city or potentially with country or a state,
0:39 and get back some kind of report in however we ask. So, if we ask for the weather in Portland, Oregon, or Portland, United States,
0:47 we'll get it back in Portland, Oregon, and we'll get legitimate real-time weather from somewhere on the Internet to be
0:54 determined. So this is what we're gonna build, and we're going to focus on a couple of iterations of making this nicer and nicer.
0:59 Where will we get the data? Well, "". This is a super cool website.
1:06 They have a free tier. I believe you get to do one million requests per day, but you can only do something like 60 requests a minute.
1:14 So it's, for the free version. So it's not completely open ended, but for our example, what we're trying to do, this is gonna completely be fine.
1:21 So what you'll need to do is log in over here and get an API key as part of this. But there's nothing to buy, nothing to do and yeah,
1:30 we'll set it up so we'll consume this weather data, pull it back, make some changes to it,
1:35 makes some adjustments to it and then return that to our users. We could also save stuff to a database, do logging, all sorts of things,
1:42 but the main part is just gonna be focusing on consuming an external API. You know, think of this as an example of micro services or credit
1:50 card purchases, or even talking to a database, like something external that we get to
1:55 talk to that will allow us to scale our Web app using some of the cool async and await features and so on.
2:00 So this is what we're gonna build, this weather service, and we're gonna back it with data coming from the API.

Talk Python's Mastodon Michael Kennedy's Mastodon