#100DaysOfCode in Python Transcripts
Chapter: Days 43-45: Consuming HTTP services
Lecture: Your turn: Day 2
Login or purchase this course to watch this video and the rest of the course contents.
0:00 Second day of this section is going to actually be to work with an entirely different API, but another one around the podcast
0:09 just to keep it simple and stable. So what your going to do is we're going to interact with this search.talkpython.fm
0:16 Now if you're over here and you're on Talk Python, and you try to search, you could say "I would like to search for let's say, a 100DaysOfCode".
0:23 Pull that up you can see it went back and found a couple of elements, an episode and a transcript, and it did this in a ridiculously
0:30 fast period of time. But there's actually an API underneath here there's JSON API, and you can write queries you can search yourself right?
0:38 it's open, and searchable for you and it's exactly like what you've been working with. So let's go over here and play with this a little bit.
0:46 Click on this, and see the raw data, This is what you get back if you search for tests, so whatever you do is you put
0:53 the little query string pieces there, so we'll put a100DaysOfCode, uh, and it's going to come back Firefox tries to make that response pretty,
1:00 but it's going to come back looking something like this. Alright, so this is the API we're going to work with. So the first thing you're donna do is
1:08 explore the API imposement, and your goal for the day is to create a program that does the following: It gets a search word from the user,
1:17 It calls the search service using that API we just looked at, it makes sure the response from the server was okay so request.
1:25 response.raise_for_status I believe, And then you want to return just a basic dictionary of the results, and use that to list out the titles.
1:36 So it should look something like this on Day 2. Run your program, it has a little header if you want, ask the user for some search terms
1:41 and it says "Boom. These are the titles."