D
D
Dmitry2017-08-21 10:51:23
Python
Dmitry, 2017-08-21 10:51:23

How to get posts from the VK group wall?

Dear experts, I searched the documentation but I can't figure out what I'm doing wrong

import vk

session = vk.Session(access_token='token')
vk_api = vk.API(session, v='5.68')

hello_command = ['привет', 'hello', 'дратути', 'здравствуй', 'здравствуйте', 'хай']

mas = vk_api.wall.get(owner_id='-151859784', count=1)
print(mas)

Traceback (most recent call last):
File "C:/Users/admin/Desktop/PycharmProjects/untitled/VK api/fonoteka.py", line 14, in
mas = vk_api.wall.get(owner_id='-151859784', count=1)
File "C:\Python35-32\lib\site-packages\vk\api.py", line 173, in __call__
return self._api._session.make_request(self)
File "C:\Python35-32 \lib\site-packages\vk\api.py", line 102, in make_request
raise error
vk.exceptions.VkAPIError: 5. User authorization failed: method is unavailable with group auth.. request_params = {'count': '1 ', 'oauth': '1', 'owner_id': '-151859784', 'v': '5.68', 'method': 'wall.get'}
I understand that something is wrong with authorization, but I don’t understand what’s wrong, the group token, I’m trying to get a record from the wall, but there is an error, help me figure it out ???

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anatoly, 2017-08-21
@ipatov_dn

The method will only work with a service access key (look in the application settings), or with a user access key (read here for this ).
02163cd081964a709a5b2725b896f778.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question