M
M
Millerish2016-06-15 20:30:24
Python
Millerish, 2016-06-15 20:30:24

Python api how to pass authorization?

Good evening!
Tell me what I'm doing wrong and how to do it right:

import vk
session = vk.AuthSession(app_id='5509191', user_login='+380985561286', user_password='qweqweqwe')
api = vk.API(session)
api.messages.get(user_id='13897175', message=" GGG")

Issues:
/usr/bin/python3.5 /home/mk/Documents/vk/py.py
Traceback (most recent call last):
File "/home/mk/Documents/vk/py.py", line 4, in
api. messages.get(user_id='13897175', message="GGG")
File "/home/mk/.local/lib/python3.5/site-packages/vk/api.py", line 173, in __call__
return self ._api._session.make_request(self)
File "/home/mk/.local/lib/python3.5/site-packages/vk/api.py", line 102, in make_request
raise error
vk.exceptions.VkAPIError: 15 .Access denied: no access to call this method. request_params = {'message': 'GGG', 'oauth': '1', 'method': 'messages.get', 'user_id': '13897175'}

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dimonchik, 2016-06-15
@dimonchik2013

Access denied: no access to call this method.
rights are not all

V
Vyacheslav, 2016-06-15
@Firik67

You forgot to add permissions

import vk
session = vk.AuthSession(app_id='5509191', user_login='+380985561286', user_password='qweqweqwe', scope='messages')
api = vk.API(session)
api.messages.get(user_id='13897175', message="GGG")

P
prawn-cake, 2016-07-08
@prawn-cake

To interact with vk in python, I recommend using the https://github.com/prawn-cake/vk-requests library
. It has a lot of fixes and tests, the code design itself has been updated + several interesting features have been added, unlike https://github. com/dimka665/vk

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question