V
V
vikholodov2017-08-24 23:49:41
Python
vikholodov, 2017-08-24 23:49:41

How to log in to Yandex using Requests?

I decided to parse wordstat.yandex.ru, I ran into a problem, it turns out that only an authorized user can work with wordstat, a modal window pops up with input
. I tried to do this:

def request(url):
    headers = {'user-agent': 'Mozilla/5.0'}
    r = requests.Session().get(url, headers=headers, auth=('vasyanya123', '123456'))
    return r.text

Does not work. Please point to the solution

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anton B, 2017-08-30
@nizzit

Try this way:

url = 'https://passport.yandex.ru/passport?mode=auth&retpath=https://yandex.ru'
data = {'login': '*****', 'passwd': '*****'}
r = requests.post(url, data=data)

A
Anatoly, 2017-08-25
@trofimovdev

Perhaps an API ?

D
Dmitry, 2017-08-25
@LazyTalent

Somehow I very much doubt that I use get requests for authorization. Look in Network what POST request the form sends.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question