B
B
BlackDog052019-10-22 21:06:04
Python
BlackDog05, 2019-10-22 21:06:04

How to get owner_id value in attachments?

Hello, I don't know how to get different owner_id, id, album_id, etc. values. when sending a photo to the bot.
Here is a part of the code from the bot for VK in Python

if event.type == VkBotEventType.MESSAGE_NEW:
            peer_id = event.object.peer_id
            message = event.object.text
            body = event.object.text.lower()
            chat_id = event.chat_id
            user_id = event.object.from_id
            user_attachments = event.object.attachments
            print("Текст сообщения: " + str(message))
            print("Отправлено от: " + str(peer_id))
            print("Вложение: " + user_attachments)
            print("---------------------------------------")
I get this answer
2019-10-22T17:45:04.373677+00:00 app[worker.1]: Текст сообщения: 
2019-10-22T17:45:04.373709+00:00 app[worker.1]: Отправлено от: 2000000001
2019-10-22T17:45:04.373751+00:00 app[worker.1]: Вложение: [{'type': 'photo', 'photo': {'id': 457242393, 'album_id': -3, 'owner_id': 212559652, 'sizes': [{'type': 's', 'url': 'https://sun9-49.userapi.com/c856520/v856520232/166c2/7Ll2vzF9N9o.jpg', 'width': 75, 'height': 39}, {'type': 'm', 'url': 'https://sun9-46.userapi.com/c856520/v856520232/166c3/uy0cVY8Cv0g.jpg', 'width': 130, 'height': 68}, {'type': 'x', 'url': 'https://sun9-19.userapi.com/c856520/v856520232/166c4/F0C-t2TRYeo.jpg', 'width': 604, 'height': 318}, {'type': 'y', 'url': 'https://sun9-24.userapi.com/c856520/v856520232/166c5/DYcmlgrkfUg.jpg', 'width': 700, 'height': 368}, {'type': 'o', 'url': 'https://sun9-72.userapi.com/c856520/v856520232/166c6/W59gku_TAb0.jpg', 'width': 130, 'height': 87}, {'type': 'p', 'url': 'https://sun9-47.userapi.com/c856520/v856520232/166c7/JU3VaPSJDnQ.jpg', 'width': 200, 'height': 133}, {'type': 'q', 'url': 'https://sun9-68.userapi.com/c856520/v856520232/166c8/TSuaBGmHJIM.jpg', 'width': 320, 'height': 213}, {'type': 'r', 'url': 'https://sun9-34.userapi.com/c856520/v856520232/166c9/kZLNqvsLY6o.jpg', 'width': 510, 'height': 340}], 'text': '', 'date': 1571766303, 'access_key': '71528793688e31af9e'}}]

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