K
K
Kirill2018-02-08 02:38:07
Python
Kirill, 2018-02-08 02:38:07

How to pass authorization on the site using the requests library (Python 3.6) if the links are generated by js?

Please help me understand the page code https://pfizer.miflib.ru/auth/#/login

I'm trying to log in to the site using python and the requests library:

import requests

LOGIN = ''
PASSWORD = ''

login_page = 'https://pfizer.miflib.ru/auth/#/login'

headers = {'User-Agent': 'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:48.0) Gecko/20100101 Firefox/48.0'}
payload = {'action': 'post',
           'email': LOGIN,
           'password': PASSWORD
           }

with requests.Session() as session:
    s = session.post(login_page, data=payload)

    print(s.text)


However, instead of going to the catalog page, I constantly return to the authorization page.

Judging by the html code of the page, links for the transition are formed using javascrypt, but I can’t figure out where this happens and where the redirect goes.

I would be grateful if you point out errors or give advice.

HTML

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question