F
F
FailureBij2021-07-21 00:08:38
Python
FailureBij, 2021-07-21 00:08:38

How to log in to a website using request python?

Good afternoon everyone!

I want to authorize via request python here https://oauth.vk.com/authorize?client_id=2685278&s... (this is a site to get my VK key)
I wrote the code, enters only the login, does not enter the password, although the name is in the source code the same as mine 'pass' what could be the problem?

import requests

datas = {
  'email':'def',
  'pass':'def'
}
login = '1111111111'
password = '11111111111'
datas['email'] = login
datas['pass'] = password
url = 'https://oauth.vk.com/authorize?client_id=2685278&scope=1073737727&redirect_uri=https://oauth.vk.com/blank.html&display=page&response_type=token&revoke=1'

s = requests.Session()
loging = s.post(url, data = datas)
f = open('result.txt', 'w')
f.write(loging.text)
f.close()

#Вход успешно воспроизведен и мы сохраняем страницу в html файл. Я открываю этот html, но там висит так же на странице авторизации только с заполненным логином
with open("vv.html","w",encoding="utf-8") as f:
    f.write(loging.text)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-07-21
@SoreMix

one.

I want to log in via request python here

This endpoint does not accept any post requests
2. The fields for authorization are different, like the other endpoint
3.
enters only login, does not enter password

What goes where?
4.
although name in source code

What name?
5. The token will be in the url, so you won't get it through the page code.
In general, there are cons on all fronts, why not use some kind of ready-made library that will issue an apikey, or open your link in the browser, open the request history and see what goes where

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question