Answer the question
In order to leave comments, you need to log in
Requests authorization fails?
Greetings, authorization does not work, always a 400 error. But if you disable the headers, then the 200 code always returns
import requests
data = {
"login" : "my_login",
"password": "my_password"
}
headers = {
"Accept":"application/json",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3",
"Connection":"keep-alive",
"Host":"ekt.profi.ru",
"Origin":"https://ekt.profi.ru",
"Referer":"https://ekt.profi.ru/backoffice/?utm_source=profi.ru&utm_medium=referral&utm_campaign=link_enter_backoffice_click",
"Sec-Fetch-Dest":"empty",
"Sec-Fetch-Mode":"cors",
"Sec-Fetch-Site":"same-origin",
"TE":"trailers",
"User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0",
"x-app-id" :"BO",
"x-new-auth-compatible":"1"
}
session = requests.Session()
response = session.post('https://profi.ru/backoffice/api/', headers=headers, data=data)
print(response)
Answer the question
In order to leave comments, you need to log in
1. A bunch of extra headers
2. Wrong Content-Type of transmitted data
3. Wrong format of transmitted data
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question