Requests Introduction & Overview – Real Python
In this lesson you’ll get a general overview about the requests library. Furthermore, it reveals you how to install requests on your machine using pip and how to import it. In fact it’s as easy as:
After installing requests you’re able to import into your project via:
When you’ve completed the course, take our interactive quiz to check your learning progress:
00:00
Hi, this is Chris Bailey. I’m going to be taking you through Python’s requests library. This is Section 1 of 3, and it will be getting started with requests, introducing the GET request, and processing responses—talking about status codes, and content, and headers.
00:15
A couple of quick details about requests. The subtitle is HTTP for Humans™. It was created by Kenneth Reitz, and this is a link to the docs.
00:25
So, why learn about requests? It’s the defacto standard for making HTTP requests in Python. It’s a beautifully simple API, it abstracts the complicated parts of HTTP, and it focuses on interaction with services. So, what do you need to know for this tutorial?
00:40
Just a basic knowledge of HTTP. You can get that from a link that’s in the article, or I’m repeating it right here, from W3Schools. All right, let’s get started. The first step is to install requests. To do that we’re going to use pip, and it’s simply pip install requests.
00:57
As you can see here, I’ve already installed it on this machine. Let’s step into a REPL. The one I’m using is called bpython.
01:05 Let’s make sure it worked. We’ll go ahead and import it.
01:10
All right, looks like it’s successful. Great! Let’s get started with the GET request.
