N
N
noob2222019-03-01 18:26:31
Python
noob222, 2019-03-01 18:26:31

Why can't I log in to vk_api?

Why can't I log in to vk_api?
Until today, everything worked fine and did not display errors, tell me how to fix
vk_session = vk_api.VkApi(login, password)
vk_session.auth()
session_api = vk_session.get_api()
longpoll = VkLongPoll(vk_session)
Traceback (most recent call last):
File "C:\Users\Asus\PycharmProjects\Bot\avto-status.py", line 12, in
longpoll = VkLongPoll(vk_session)
File "C:\Users\Asus\PycharmProjects\Bot\venv\lib\site-packages \vk_api\longpoll.py", line 503, in __init__
self.update_longpoll_server()
File "C:\Users\Asus\PycharmProjects\Bot\venv\lib\site-packages\vk_api\longpoll.py", line 513, in update_longpoll_server
response = self.vk.method('messages.getLongPollServer', values)
File "C:\Users\Asus\PycharmProjects\Bot\venv\lib\site-packages\vk_api\vk_api.py", line 615, in method
raise error
vk_api.exceptions.ApiError: [15] Access denied: no access to call this method

Answer the question

In order to leave comments, you need to log in

2 answer(s)
H
Helow19274, 2019-03-01
@Helow19274

VK closed the messaging API for users, use the group token. https://vk.com/dev/messages_api

I
Ivan Mikhailov, 2019-03-04
@IvanMikhaylov

login, password = 'ЛОГИН', 'ПАРОЛЬ'
vk_session = vk_api.VkApi(login, password)
try:
    vk_session.auth()
except vk_api.AuthError as error_msg:
    print(error_msg)
    return

vk = vk_session.get_api()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question