M
M
MarkSmersh2021-06-25 15:37:26
Python
MarkSmersh, 2021-06-25 15:37:26

Why such a user longpoll response?

When I try to display the response of user longpoll (and it is he who is needed, not bot), I get something different from what comes out if I use bot longpoll. Is that how it's meant to be, or am I doing something wrong?

Here is the code:

import vk_api

vk_session = vk_api.VkApi(token='токенчик')

from vk_api.longpoll import VkLongPoll, VkEventType
vk = vk_session.get_api()

longpoll = VkLongPoll(vk_session)    

for event in longpoll.listen():
    if event.type == VkEventType.MESSAGE_NEW:
        print (event)


Output:

vk_api.longpoll.Event object at 0x000002E2BA6726A0

Answer the question

In order to leave comments, you need to log in

2 answer(s)
0
0ralo, 2021-06-25
@MarkSmersh

This is an old liba, low-level. Event - object therefore so writes. To see something interesting, use the debug mode or print(event.__dict__)(like this)

H
HemulGM, 2021-06-25
@HemulGM

Because event is an object

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question