#100DaysOfCode in Python Transcripts
Chapter: Days 31-33: Logging
Lecture: Demo: Introducing our app

Login or purchase this course to watch this video and the rest of the course contents.
0:00 For our application, we're going to return to something
0:03 you've seen on day 10 and on day 25.
0:07 Let's go over here to the GitHub repository.
0:09 We're going to go back to our Movie Search application
0:11 that's going to call a web service and talk to the server;
0:15 talk to the Movie Search service that we've already talked
0:18 about in terms of using JSON APIs, and in terms
0:21 of air handling.
0:22 There's no record of what happened with this app, so
0:24 we're going to extend it further by adding logging to
0:27 this simple application.
0:29 Over here on the logging section, you can see we have
0:32 a starter movie search in case you want to recreate this
0:35 for some reason, and then here we have what's going to be
0:38 the final version.
0:39 Before I open this in PyCharm, let's create the virtual
0:41 environment.
0:42 Here we are in the directory we're going to work in.
0:46 Create our little virtual environment here, and we'll be
0:49 done with that. We're just going to open this in PyCharm.
0:56 Here we are in this application.
0:58 We should have our virtual environment active; we do.
1:02 We don't have anything installed; we have a requirements
1:05 file that says we have to have requests, so let's go
1:07 ahead and install that.
1:08 In fact, we're going to use Logbook, so I'll go ahead and add
1:11 Logbook here as well, and then we can say "pip install
1:14 -r requirements".
1:17 Or, I could just click this.
1:19 Great, now we have Logbook and we have requests and
1:22 their various dependencies.
1:25 Let's just go ahead and run this real quick here, so:
1:27 Run the Program.
1:31 It's going to go off to the server; let's search for Capital:
1:35 we found three movies there.
1:37 We could search for Action, and we're getting stuff back.
1:41 However, if we turn off our internet,
1:44 we try this again with anything,
1:47 Boom: "Error. Could not find server. Check your network
1:49 connection".
1:51 Recall, over here, we added our try-except block
1:54 and we have these various pieces there.
1:57 What we're going to do is take this application and record
2:00 a couple of things: what people are searching for, maybe
2:04 how many results were found, the time of day when that was
2:07 done, and of course if there's any errors, we're going
2:10 to record those errors as well.