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?
0:01 Well, a ton of amazing things.
0:04 The primary focus, the thing that we're going to get the most out of with
0:08 this chapter, is working with external packages or libraries.
0:12 There's a place called PyPi, or Python Package Index,
0:15 and we're going to use this tool called "pip" to
0:18 access all the libraries there, and we can just plug those right into our application,
0:22 and there's literally hundreds of thousands of libraries out there that we can use, from
0:28 computer vision to machine learning to working with stuff on the Internet and calling
0:32 API's and so on.
0:33 So that's what we're really going to focus on, using these external libraries to make
0:37 working with this weather data on remote servers
0:40 super easy and straightforward. Python is often referred to as having batteries included.
0:46 That means it has so much contained within it.
0:48 Rather than writing a bunch of functionality,
0:50 you could just grab little pieces and put it together.
0:53 A lot of times that means working with something from the standard library.
0:57 But even more than that, this PyPi place with hundreds of thousands of libraries
1:01 are also right at your fingertips.
1:04 So if you need to build almost anything,
1:06 there's probably a library that either does that, or it will help you much more easily build that
1:12 thing. When we talk to our weather service,
1:14 we're gonna create an http client, that's basically a major part of our application, to go
1:19 out there and do a web request.
1:21 We're gonna use API endpoint. That API is gonna return a certain type
1:25 of data called JSON, which is very,
1:27 very popular in API's.
1:28 So we're gonna work with JSON and Python. In order to install our external packages correctly
1:34 and isolate them on a per application or per project basis,
1:37 we're gonna work with these things called "virtual environments".
1:40 The actual library that we want to use
1:42 to call our API,
1:43 to build the HTTP client is something called "requests".
1:46 It's one of the most popular packages in the world, in the Python space.
1:51 I believe it's downloaded about seven million times a month,
1:54 so yeah, no joke. It's very popular.
1:56 And finally, we're gonna be passing multiple pieces of data from one function to another
2:00 and we'll see that there's this concept of tuples,
2:03 these data structures that hold more than one thing.
2:06 We'll be able to pass multiple things around using these tuples.
2:10 However, they're a little bit clumsy,
2:11 so we can use this more improved version that comes from the Python standard library called
2:16 "named tuples". You're going to get a ton out of this chapter,
2:21 and it's gonna be a lot of fun to see how all these pieces fit together.