#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 you've seen on day 10 and on day 25. Let's go over here to the GitHub repository.
0:10 We're going to go back to our Movie Search application that's going to call a web service and talk to the server;
0:16 talk to the Movie Search service that we've already talked about in terms of using JSON APIs, and in terms of air handling.
0:23 There's no record of what happened with this app, so we're going to extend it further by adding logging to this simple application.
0:30 Over here on the logging section, you can see we have a starter movie search in case you want to recreate this
0:36 for some reason, and then here we have what's going to be the final version. Before I open this in PyCharm, let's create the virtual environment.
0:43 Here we are in the directory we're going to work in. Create our little virtual environment here, and we'll be
0:50 done with that. We're just going to open this in PyCharm. Here we are in this application. We should have our virtual environment active; we do.
1:03 We don't have anything installed; we have a requirements file that says we have to have requests, so let's go ahead and install that.
1:09 In fact, we're going to use Logbook, so I'll go ahead and add Logbook here as well, and then we can say "pip install -r requirements".
1:18 Or, I could just click this. Great, now we have Logbook and we have requests and their various dependencies.
1:26 Let's just go ahead and run this real quick here, so: Run the Program. It's going to go off to the server; let's search for Capital:
1:36 we found three movies there. We could search for Action, and we're getting stuff back. However, if we turn off our internet,
1:45 we try this again with anything, Boom: "Error. Could not find server. Check your network connection". Recall, over here, we added our try-except block
1:55 and we have these various pieces there. What we're going to do is take this application and record
2:01 a couple of things: what people are searching for, maybe how many results were found, the time of day when that was
2:08 done, and of course if there's any errors, we're going to record those errors as well.


Talk Python's Mastodon Michael Kennedy's Mastodon