2

I have a website that requires login then allows a search api, that's public, it's returning error 405, How do I give parameters in requests.post, since following code isn't working

response = requests.post(  
    'https://www.somewebsite.com/api/public/',   
    auth=('asct1@gmail.com', 'Cons')
)

1 Answers1

0

As you can see here 405 means that the method you chose in your case .get(...) is not allowed on the endpoint. https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405

You wrote as well that you should make a Post request. So give requests.post(...) a try!

Happy Coding, T!

Thomas
  • 26
  • 1
  • Yes Actually it was Post only, which was giving 405 error, I edited the question.. Sorry – Mandwa Tera Jun 18 '21 at 08:04
  • The request should be fine, it is more the configuration of the endpoint you are sending the request to which doesn't allow a post request. Do you mind sharing the code for the endpoint as well? – Thomas Jun 18 '21 at 12:19