Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Inspecting Requests

Give Feedback

Do you know about inspecting a request you just sent? If not, this lesson is right for you! To give you sense of how to do it, let’s have a look at how to get the URL of the request you sent:

>>> response.request.url

Shafin Thiyam on June 20, 2021

urlpost='https://httpbin.org/post' request raise 405 error

Bartosz Zaczyński RP Team on June 21, 2021

@Shafin Thiyam The HTTP status code 405 means “method not allowed”. You’re most likely viewing the address in a web browser, which sends an HTTP GET request by default. You want to send your data with the POST method instead. To do that, you can use cURL in the command line, for example:

$ curl -i -X POST https://httpbin.org/post -H 'Content-Type: application/json' --data '{"key": 42}'
HTTP/2 200 
date: Mon, 21 Jun 2021 06:07:18 GMT
content-type: application/json
content-length: 416
server: gunicorn/19.9.0
access-control-allow-origin: *
access-control-allow-credentials: true

{
  "args": {}, 
  "data": "{\"key\": 42}", 
  "files": {}, 
  "form": {}, 
  "headers": {
    "Accept": "*/*", 
    "Content-Length": "11", 
    "Content-Type": "application/json", 
    "Host": "httpbin.org", 
    "User-Agent": "curl/7.58.0", 
    "X-Amzn-Trace-Id": "Root=1-60d02c96-7d669c2e4c0324306e437fe4"
  }, 
  "json": {
    "key": 42
  }, 
  "origin": "89.64.35.172", 
  "url": "https://httpbin.org/post"
}

Become a Member to join the conversation.