Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Divothy
Participant

Login through python

For some reason I am facing an issue using the login API through Python which works fine when using Postman:

import requests

checkpoint_session = requests.session()
checkpoint_session .headers.update({r"Content-Type": r"application/json"})
checkpoint_session .post(r"https://<IP>/web_api/v1.1/login", verify=False, data={
"user": "<user>",
"password": "<password>"
})

 

The return from the post request would be: "Login request message processing failed."

(The access settings is set to All IP addresses. And I run the script from the same machine that I run Postman.)

What could be the problem?

0 Kudos
1 Reply
FraP
Contributor

This seems a malformed request

Try:

import json
payload={"user": "<user>","password": "<password>"}
checkpoint_session.post(r"https://<IP>/web_api/v1.1/login", verify=False, data=json.dumps(payload))

 

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events