At the entrance to the site, you must log in. As I understand it, making it necessary to save cookies and then use them? How to implement it? My sketches

s = requests.Session() r = s.get('https://login.dnevnik.ru/login', auth = ('log', 'pass')) r = s.get('https://dnevnik.ru/user/') print(r.text) 
  • Different sites can use different mechanisms for user logins - jfs
  • is your option not working? In principle, all right. First log in, then pick up the desired page. - Dmitry Erohin
  • @jfs Suppose I can send via the form {'login': 'log', 'password': 'pass'}. But this does not change the essence, cookies are not saved, I can not go to the '/ user' page, since I am not authorized. Tell me what to do? - r4d1f
  • @jfs Lol, and did, it turned out. Am I a fool or yes? - r4d1f

1 answer 1

Solved own problem.

 def main(): s = requests.Session() r = s.post('https://login.dnevnik.ru/login', data = {'login':'login', 'password':'pass'}) r = s.get('https://dnevnik.ru/user') print(r.text)