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

    Wed 01 May 2024 @ 02:00 PM (EDT)

    South US: HTTPS Inspection Best Practices

    Tue 23 Apr 2024 @ 11:00 AM (EDT)

    East US: What's New in R82

    Thu 25 Apr 2024 @ 11:00 AM (SGT)

    APAC: CPX 2024 Recap

    Tue 30 Apr 2024 @ 03:00 PM (CDT)

    EMEA: CPX 2024 Recap

    Wed 01 May 2024 @ 02:00 PM (EDT)

    South US: HTTPS Inspection Best Practices

    Tue 23 Apr 2024 @ 11:00 AM (EDT)

    East US: What's New in R82

    Thu 25 Apr 2024 @ 11:00 AM (SGT)

    APAC: CPX 2024 Recap

    Tue 30 Apr 2024 @ 03:00 PM (CDT)

    EMEA: CPX 2024 Recap

    Thu 02 May 2024 @ 11:00 AM (SGT)

    APAC: What's new in R82
    CheckMates Events