Python Jumpstart by Building 10 Apps Transcripts
Chapter: App 5: Real-time weather client
Lecture: What you will learn
0:00 What are we gonna learn in this chapter? Well, a ton of amazing things. The primary focus, the thing that we're going to get the most out of with
0:09 this chapter, is working with external packages or libraries. There's a place called PyPi, or Python Package Index,
0:16 and we're going to use this tool called "pip" to access all the libraries there, and we can just plug those right into our application,
0:23 and there's literally hundreds of thousands of libraries out there that we can use, from
0:29 computer vision to machine learning to working with stuff on the Internet and calling API's and so on.
0:34 So that's what we're really going to focus on, using these external libraries to make working with this weather data on remote servers
0:41 super easy and straightforward. Python is often referred to as having batteries included. That means it has so much contained within it.
0:49 Rather than writing a bunch of functionality, you could just grab little pieces and put it together.
0:54 A lot of times that means working with something from the standard library.
0:58 But even more than that, this PyPi place with hundreds of thousands of libraries are also right at your fingertips.
1:05 So if you need to build almost anything, there's probably a library that either does that, or it will help you much more easily build that
1:13 thing. When we talk to our weather service, we're gonna create an http client, that's basically a major part of our application, to go
1:20 out there and do a web request. We're gonna use API endpoint. That API is gonna return a certain type of data called JSON, which is very,
1:28 very popular in API's. So we're gonna work with JSON and Python. In order to install our external packages correctly
1:35 and isolate them on a per application or per project basis, we're gonna work with these things called "virtual environments".
1:41 The actual library that we want to use to call our API, to build the HTTP client is something called "requests".
1:47 It's one of the most popular packages in the world, in the Python space. I believe it's downloaded about seven million times a month,
1:55 so yeah, no joke. It's very popular. And finally, we're gonna be passing multiple pieces of data from one function to another
2:01 and we'll see that there's this concept of tuples, these data structures that hold more than one thing.
2:07 We'll be able to pass multiple things around using these tuples. However, they're a little bit clumsy,
2:12 so we can use this more improved version that comes from the Python standard library called
2:17 "named tuples". You're going to get a ton out of this chapter, and it's gonna be a lot of fun to see how all these pieces fit together.