I tried to log in using a POST request from pythonhttps://admin.raptor.software
but was unable to log in.
I'm using the following code snippet:
import requests_html session = requests_html.HTMLSession() r = session.get('https://admin.raptor.software') csrf = r.html.xpath('/html/head/meta[4]')[0].attrs['content'] data = { 'client_id': '2', 'client_secret': csrf, 'grant_type': 'password', 'password': 'MYPASSWORD', 'username': 'MYEMAIL' } session.post('https://admin.raptor.software/api/login', data = data)
I need it to publishcsrf
, so I use therequests_html
library to get it.
After successful login, I want to print the dashboard HTML using the following code, but it posts the login page HTML above:
r = session.get('https://admin.raptor.software/dashboard') print(r.text)
Admin
Try using
What this script does is, it does everything as your script does, but I use requests instead of requests_html
I tried my script on Google and other platforms and it worked.
Hope it’s useful!