Answer the question
In order to leave comments, you need to log in
Who can help with the problem of authorization through python?
Good afternoon, help please. I need to parse site elements that appear after authorization.
After running the code, it displays ReturnUrl
import urllib.request
import bs4
from bs4 import BeautifulSoup
import requests
import json
def main():
data = {
"login": "maks********20",
"password": "V******35"
}
r = requests.post('https://login.school.mosreg.ru/user/login', data=data)
print(r.status_code)
print(r.text)
if __name__ == '__main__':
main()
200
{"returnUrl":"https://school.mosreg.ru:443/?utm_source=school.mosreg&utm_medium=uslugi&utm_campaign=login","forceRedirect":false}
Answer the question
In order to leave comments, you need to log in
Either use requests.session() or manually receive cookies after authorization and pass them when requesting pages with the necessary data at the necessary urls.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question