S
S
Sergey Sergey2021-02-04 22:12:29
Python
Sergey Sergey, 2021-02-04 22:12:29

How does appWidgets.update work?

Can someone please tell me how the appWidgets.update method works
There are no request examples
in the doc My python code doesn't work
Just nothing happens and no errors are thrown

import sys

import vk_api, random
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType
from vk_api.keyboard import VkKeyboard, VkKeyboardColor
import sqlite3, hashlib

con = sqlite3.connect("bot_vk.db")
cur = con.cursor()
TOKEN = 'ывафвф'
club_id = 'уафыв'
t = """return {
    "title": "My Table",
    "title_url": "https://link",
    "title_counter": 31,
    "more": "All",
    "more_url": "https://link2",
    "head": [{
        "text": "First"
    }, {
        "text": "Second",
        "align": "center"
    }],
    "body": [
        [{
            "text": "This First",
            "icon_id": "3484735_23434324"
        },
            {
                "text": "This second",
                "url": "https://vk.com/wall-12345_542321"
            }],
        [{
            "text": "This second first",
            "icon_id": "3484735_23434324"
        },
            {
                "text": "This second second",
                "url": "https://vk.com/wall-12345_54321"
            }
        ]
    ]
};"""


def main():
    vk_session = vk_api.VkApi(
        token=TOKEN)
    longpoll = VkBotLongPoll(vk_session, club_id)

    vk = vk_session.get_api()
    vk.appWidgets.update(type='table', code=t)


if __name__ == '__main__':
    while True:
        try:
            main()
        except Exception:
            pass

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question