#100DaysOfCode in Python Transcripts
Chapter: Days 43-45: Consuming HTTP services
Lecture: The requests package
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
We've seen how to poke at our API with just doing a GET request. We've seen Postman lets us explore better
0:07
but if we want to access it from code, we need another way. Now, Python has a built in mechanism for accessing HTTP APIs
0:15
but it's not the prettiest thing in the world. So a guy named Kenneth Reitz created this thing called Requests. Maybe you've heard of it.
0:22
It's definitely one of the most popular packages, period. And to use it is really, really simple. We're going to use it in just a moment.
0:29
If you want to get a URL, you just say GET. Here you can even pass the auth, check the status code, check the encoding, check the text,
0:35
and even convert the JSON back to Python dictionaries. So this is a very popular library. It's definitely the most-used for accessing HTTP services
0:44
or Python directly. So, unless for some reason, you are very adverse to having a dependency on an external package, this is the way,
0:50
this is the way we're going to do it in Python. So, next up, let's get started and actually write some code.