Python Forum
Message not supported for all requests in python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Message not supported for all requests in python
#1
why I'm getting "message not supported" for all request made through python request module?

"<Response [405]>"

...
response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(usr,pwd))
...
Reply
#2
https://developer.mozilla.org/en-US/docs...Status/405

405 isn't "message not supported", it's "method not supported".  So whatever url your using likely doesn't accept POST.
Reply
#3
yes its method not supported

Actually I tried with POST and GET,
For POST its message not supported and response code is 501
For GET its method not supported and response code is 405

I need to use post to configure something, but its not happening
Reply
#4
Does it work using other means (ie: not python or requests)? Such as fiddler or in the browser?

To me, this doesn't look like an issue with requests, it looks like a missing header or something.
Reply
#5
Yes In browser its working fine and I'm getting the response as 200.

Also when I installed ubuntu16.04 in one of my VM and in terminal I did "import request" in the python3 (which is python 3.5) terminal and also in python terminal. Import request works in python3 terminal and not in python (which is python 2.7 - default terminal).

This request.post() also the similar way its working in python3, when its fresh ubuntu.
Then I installed request module for python in ubuntu. The request.post() got message not supported on both python2 as well as python3.

I'm not sure what happens when I install python-request module.
Reply
#6
You can get a complete list of all codes here: http://www.rfc-editor.org/pdfrfc/rfc7231.txt.pdf
or if you prefer text file, here: http://www.rfc-editor.org/rfc/rfc7231.txt
Reply
#7
Hi Larz60+,

I get the 501 - message not supported, as per the document its a web server issue (not implemented).

If that is a web server issue "why request.post(...) working with python3 in ubuntu?"
Reply
#8
(Jul-20-2017, 05:46 AM)Prabakaran141 Wrote: I get the 501 - message not supported


https://en.wikipedia.org/wiki/List_of_HTTP_status_codes Wrote:501 Not Implemented
The server either does not recognize the request method, or it lacks the ability to fulfil the request. Usually this implies future availability (e.g., a new feature of a web-service API).
Reply
#9
It means it will not completely work for my request. In future it might be available.
Reply
#10
(Jul-20-2017, 04:59 AM)Prabakaran141 Wrote: Yes In browser its working fine and I'm getting the response as 200.

That means you can do it, too, but the way you're trying to do it isn't the same as whatever the browser is doing. So open the inspector (for the good browsers, that's F12 or ctrl+j), and watch the network tab when you do it. Once you see the url, http method, and payload, try to recreate it in an external program such as fiddler. Once you have it working THERE, it should be simple for you to recreate it using requests.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Getting "SSL client not supported by this Python installation" error prabirsarkar 0 914 Mar-13-2023, 05:01 PM
Last Post: prabirsarkar
  python requests library .JSON() error mHosseinDS86 6 3,232 Dec-19-2022, 08:28 PM
Last Post: deanhystad
  Python requests oauth2 access token herobpv 6 3,765 Sep-27-2021, 06:54 PM
Last Post: herobpv
  Python Requests SSL Aussie 0 1,959 Jan-07-2021, 02:09 AM
Last Post: Aussie
  Python Requests Aussie 2 2,688 Dec-23-2020, 03:24 AM
Last Post: Aussie
  Python Requests package: Handling xml response soumyarani 1 2,101 Sep-14-2020, 11:41 AM
Last Post: buran
  Python API and requests deep_logic 9 4,177 Jul-29-2020, 03:47 PM
Last Post: ndc85430
  How to save Python Requests data sent to server? RedLeonard 5 4,791 Jul-05-2020, 10:33 AM
Last Post: RedLeonard
  How to do the same as python -m requests.certs inside script? geekgeek 2 2,231 Feb-27-2020, 07:11 AM
Last Post: buran
  How to get valid error message while invoking REST API through Python gollupraveen 0 2,049 Oct-04-2019, 07:15 PM
Last Post: gollupraveen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020