00:0.04 Let's jump back to our simple first project over here.
00:3.24 It just says Hello World. But what if we made it do something more interesting
00:6.55 Check this out over here.
00:9.12 We have at wheather.talkpython.fm.
00:11.46 There's a cool little API that if you click on it and you put
00:14.84 your city state country and units and stuff,
00:17.56 you'll get the forecast for your location back.
00:21.04 So what if we wanted to say Hello World.
00:23.0 Currently it is whatever the temperature is out there.
00:25.94 So this is easy to do right import requests.
00:29.44 We're gonna use requests and wait a minute.
00:32.7 There's an error. That doesn't make a lot of sense.
00:35.14 If we go down here, notice there's a python packages and you can see what's
00:38.73 installed. Well, we just have wheel and set up tools that's missing requests.
00:43.89 And if we could actually go over here,
00:46.74 we could go find popular things like requests and I could install it this way.
00:50.09 You could say add a package.
00:51.6 You go get type requests and just get it this way as well,
00:55.34 right at the top, click install.
00:57.95 But then the next person who gets it,
01:0.18 the next person who checks out this code or even if that next person is you
01:3.54 on a different machine, it's not going to know that it needs it.
01:6.81 So a real common way. And what I'm doing these days is I'll make sure
01:10.13 I'll have a requirements.txt file and in there,
01:16.73 I'll put things like requests and now notice PyCharm automatically knows what is installed here
01:24.05 Into our packages installed. Ones.
01:28.57 there's nothing called that. But there's these two that are installed.
01:31.34 These three, they're installed. They're not what we need but it knows it will
01:35.12 install. If we just click this button.
01:36.89 So that would be the equivalent of coming over here saying pip
01:40.5 install - our requirements, notice we have our terminal.
01:44.12 This is my 'Oh-My-Zshell' with all the history and everything because this is my
01:48.29 real shell. I could click this and of course that will install request as you
01:52.0 probably know. Or I could just click this button,
01:55.94 wait for a moment down here,
01:57.13 notice this and now requests and all the other things like if I had 
02:1.54 'TQDM' was there as well,
02:3.38 which is like a cool progress bar.
02:5.74 It would also have installed both of those at the same time.
02:10.54 So that's super cool. That's part of the project.
02:14.41 Understanding that PyCharm does it knows at the top of our project,
02:18.74 we've got this requirements file and this describes what you need to get your project going
02:23.17 after you've created your virtual environment.
02:25.04 So what the heck, let's go ahead and just write this real quick cause it'll
02:27.44 be fun if we want to call it API
02:30.18 will go over and say the 'resp=requests.get'
02:35.54 the URL, which is that great giant long thing then we can 'resp.raise_for_status( )'
02:40.9  to make sure it worked.
02:42.21 And we'll say 'data = resp.json' and I've honestly forgotten what this looks like.
02:48.66 So what we need to do is go look at the raw data so we'll get
02:53.42 the forecast and then the temp Say 'temp = data['forcast'] of ['temp']
03:2.92 and just hope that it's there.
03:7.64 Make that an F string, give it a go look at that right now.
03:10.85 It is summertime. And those are Fahrenheit.
03:13.64 Hopefully not Celsius. Hello world,
03:15.64 it's 85 F outside. Lovely,
03:18.52 lovely. Okay, so when we work with these external libraries,
03:22.32 the simplest and most straightforward is to just have these requirements here and then say that
03:27.2 we need to use those files finally we could even add them in here.
03:31.37 If I said I was using SQLalchemy.
03:37.04 The first step would be to install it but the second one would actually allow it
03:40.44 to add that requirement back in.
03:42.44 So let's go and do that even but now it's gone from an error to a
03:48.59 suggestion and we could say add this over to our requirements file which then puts it
03:54.63 right there. It was sort of bi directional and super cool.
