Other HTTP Methods
This lesson covers three other HTTP methods than the GET method you learned earlier about. These include:
To test these methods the httpbin.org service from Kenneth Reitz is used. Besides the three HTTP methods covered in this video a few other popular exist including HEAD, PATCH, and OPTIONS.
We’ll be testing these using Kenneth Reitz’s
httpbin service, and that’s found at
httpbin.org and then slash (
/) whatever the name of the method is—could be
delete, and so forth. So let’s test it out. Okay, for this we’re going to really work mostly in the terminal, so I’m going to close our file and resize the window.
And then for
post(), we would be sending some form of data into it as a dictionary. All right, let’s try it. And we can again look at our
response, we can look directly at its
.status_code, which is
And this one, where somebody’s just choosing to delete at that location. Okay, and we can look at status. On this one, we can actually do that thing where we change it into a JSON response to look at the data. Take our
response, and use this method.
We could look at a variety of things, like we could look at here, what the arguments were, what the data was—just by putting in the key. So as you can see, headers, response bodies, status codes—they’re all returned in the
Response for each of these methods. Next, we’re going to dive a little bit deeper into the
PATCH methods and learn how they differ from the other request types.
Become a Member to join the conversation.