#100DaysOfCode in Python Transcripts
Chapter: Days 43-45: Consuming HTTP services
Lecture: The requests package
0:00 We've seen how to poke at our API
0:02 with just doing a GET request.
0:03 We've seen Postman lets us explore better
0:06 but if we want to access it from code, we need another way.
0:09 Now, Python has a built in mechanism
0:12 for accessing HTTP APIs
0:14 but it's not the prettiest thing in the world.
0:16 So a guy named Kenneth Reitz created
0:19 this thing called Requests.
0:20 Maybe you've heard of it.
0:21 It's definitely one of the most popular packages, period.
0:25 And to use it is really, really simple.
0:27 We're going to use it in just a moment.
0:28 If you want to get a URL, you just say GET.
0:30 Here you can even pass the auth,
0:31 check the status code, check the encoding, check the text,
0:34 and even convert the JSON back to Python dictionaries.
0:37 So this is a very popular library.
0:39 It's definitely the most-used for accessing HTTP services
0:43 or Python directly.
0:44 So, unless for some reason, you are very adverse
0:46 to having a dependency on an external package,
0:48 this is the way,
0:49 this is the way we're going to do it in Python.
0:51 So, next up, let's get started
0:53 and actually write some code.