Answer the question
In order to leave comments, you need to log in
Authorization via Post request for a form using requests?
What Python code will be able to log in to the site after entering its username and password to get the closed page https://employee-sales.bsh-group.ru/myaccount/staf...
import requests
from bs4 import BeautifulSoup
HEADERS = {......}
dat = {
'loginUrl' : '/sys/login',
'errorPageUrl' : 'https://employee-sales.bsh-group.ru/myaccount/staff-login',
'successPageUrl' : 'https://employee-sales.bsh-group.ru/myaccount/staff-login',
'username' : 'def',
'password' : 'def',
'_csrf' : 'def'
}
login = input('Login: ')
passwd = input('Password: ')
dat['username'] = login
dat['password'] = passwd
s = requests.Session()
ppp = s.post("https://employee-sales.bsh-group.ru/sys/login" ,headers=HEADERS, data=dat)
print(ppp.status_code)
Answer the question
In order to leave comments, you need to log in
Check if the header is correct. Perhaps there is something missing in the cookies, try first to always go to the authorization page (the page with the fields for entering your login and password) and then send a request within the same session. It's also rather strange to see _csrf in payload and not in cookies.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question