The GET Request
This lesson covers the HTTP GET request in general and how to create one using the
requests library in specific. You’ll also get a short introduction to response status codes.
GET request indicates that you’re trying to retrieve data from a specified resource. We’re going to be testing it out with GitHub’s Root Rest API, with the URL
api.github.com. It’ll return a response, which is basically an object containing the results of your request.
We’re going to be going to this URL several times throughout the tutorial, so it’ll make it a little bit easier to perform a request. Let’s try it out. It’s simply
requests.get() and then we’d put the
url or whatever URL you have that you want to try out. Congratulations!
You got a
Response with a status code of
200. The information that comes back from your
GET request can be saved into a
Response object, if we create a variable for it, we can do a variety of methods against it that allow us to inspect it and look at the contents. First off, we can just simply enter the name of the variable back in, and we can see that it shows that same
Response and status code of
Become a Member to join the conversation.