#100DaysOfCode in Python Transcripts
Chapter: Days 43-45: Consuming HTTP services
Lecture: Exploring the service
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Over here at movie_service by talkpython.fm
0:04
we have a service that has, I guess probably a couple
0:06
thousand movies.
0:08
Notice down here this does not have all the movie data that
0:11
you might want, it only has some of the movies, but it's
0:14
more than enough for us to play with.
0:17
There's three things that this service will let you do.
0:20
It will let you basically search by keyword, so we come over
0:25
here and call API search, and here we're searching for run.
0:29
And firefox likes to give you this pretty view here,
0:32
let's go in and just look at the raw, so you can know what
0:33
you're getting.
0:35
So here, the keyword is run, and we've got some hits.
0:38
And hits were for things like 'The Rundown',
0:41
and 'Runaway Bride', and 'Bladerunner' and 'Chicken Run',
0:44
and all these movies here.
0:46
So we'll be able to put whatever we want in the
0:49
here, if we wanted away, boom.
0:51
'Flushed Away' is the first result.
0:53
It apparently has to do with sewers and rats and frogs.
0:56
Anyway, we can search for these movies using the service,
0:59
and what we get back is this format here called JSON,
1:02
which is the JavaScript Object Notation.
1:06
This is probably the most popular format for data exchange
1:10
over these HTP services.
1:12
So it's great we can do it here, but we also want to do this
1:16
in a slightly more structured way.
1:19
So we're going to look at two ways.
1:21
One using a tool specifically for accessing and working with
1:25
APIs, cause it is pretty simple to go up here and type enter
1:29
but what if our interaction required us to change the
1:32
headers?
1:33
If our interaction required us to do an HTTP POST rather than
1:35
a GET, which is what you normally do in browsers.
1:38
That gets tricky.
1:39
So we're going to see a tool that helps us explore the full
1:42
spectrum of APIs, and then we're going to interact with it
1:44
from Python.