I
I
Ilya Bugaets2021-10-06 20:32:15
Python
Ilya Bugaets, 2021-10-06 20:32:15

How to log in and parse the site?

I want to write my own bot for an electronic journal, but I can't even get past the initial stage (parsing)
I need to enter the site https://riso.sev.gov.ru/authorize and parse the rating page
But here's the catch. After executing the code with authorization, it returns another page to me
. I decided to parse the registration page and the answer is exactly the same as with authorization.

import requests
from bs4 import BeautifulSoup
session  = requests.Session()

UserAgent = "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36"

html = session.get('https://riso.sev.gov.ru/authorize', headers={'User-Agent': UserAgent, 'Upgrade-Insecure-Requests': '1'})

print(html.text)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-10-07
@ilyabugaets

The request was sent incorrectly. Correct option:

data = {'username': (None, 'login'),
        'password': (None, 'pass'),
        'return_url': (None, '/')}

authorization = session.post('https://riso.sev.gov.ru/ajaxauthorize', files=data)

See what traffic is going through F12 - Network in the browser. Then we just repeat the request

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question