Answer the question
In order to leave comments, you need to log in
Authorization requests post python, getting empty data?
I'm trying to authorize via requests.post, but authorization fails and I get empty data
import requests
headers = {
"User-Agent":
"Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36",
'Content-Type': 'text/html; charset=UTF-8'}
s = requests.Session()
s.headers.update(headers)
s.get('https://edu.tatar.ru')
s = s.post('https://edu.tatar.ru/logon', data={'main_login': 'login', 'main_password':'pass'})
print(s.text)
Answer the question
In order to leave comments, you need to log in
Try like this:
s = requests.Session()
s.headers.update(headers)
s.post('https://edu.tatar.ru/logon', data={'main_login': 'login', 'main_password':'pass'})
response = s.get('https://edu.tatar.ru')
print(response.text)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question