I found the code for authorization, it seems to work:
import lxml.html import requests login = 'логин' password = 'пароль' url = 'https://vk.com/' headers = { 'User-Agent':'Mozilla/5.0 (Windows NT 6.0; rv:14.0) Gecko/20100101 Firefox/14.0.1', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language':'ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3', 'Accept-Encoding':'gzip, deflate', 'Connection':'keep-alive', 'DNT':'1' } session = requests.session() data = session.get(url, headers=headers).content page = lxml.html.fromstring(data) form = page.forms[0] form.fields['email'] = login form.fields['pass'] = password response = session.post(form.action, data=form.form_values()) print(response.text) Help me figure out how to see in the future which post requests are sent from the site, and how to catch them, in order to transfer them to python.
PS Did as user Mr Morgan spoke and got these values
act:a_send al:1 gid:0 guid:151773532908381 hash:1517735163_cd46fbd56673503461 im_v:2 media: msg: test message random_id:626404632 to: id того, кому я писал Further Mr Morgan wrote
You will see the values of variables, they need to be specified as a dictionary (similar to headers), but passed as data.
But the variables guid , hash and random_id constantly changing, how to form them?