E
E
Evgeny Lavrov2019-10-03 11:55:56
Python
Evgeny Lavrov, 2019-10-03 11:55:56

How to create vk api poll in python?

The official documentation says that add_answers is json data, which
is probably why it doesn't work. Correct the code please

import vk_api

vk_session = vk_api.VkApi('логин', 'пароль')
vk_session.auth()
vk = vk_session.get_api()

print(vk.polls.create(question='test', add_answers= [{'text':'test1'}]))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Yakushenko, 2019-10-03
@lavrov2002

When did the list turn into json ?

create(question='test', add_answers=json.dumps({'text':'test1'}))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question