How do I upload image files to the community wall and to my wall correctly?
Opened this issue · 1 comments
surgutandrey commented
How do I upload image files to the community wall and to my wall correctly? Please help me! I've tried different methods, I can't figure it out!
Окружение
vk_api: 11.9.9
Пример
vk_session = vk_api.VkApi(token=config.vk_token)
vk = vk_session.get_api()
upload = VkUpload(vk_session)
attachments = []
if photos:
for idx, image in enumerate(photos):
image.seek(0)
photo = upload.photo_wall(photos=image, user_id = 4395736, group_id=group_id)
print(photo)
attachments.append(f"https://vk.com/photo-{photo[0]['owner_id']}_{photo[0]['id']}")
post_params = {
'owner_id': f"-{group_id}",
'message': text,
'attachments': ','.join(attachments) if attachments else None
}
response = vk.wall.post(**post_params)
surgutandrey commented
Как правильно загрузить файлы изображений на стену сообщества и на свою стену? ПРошу помощи! Перепробовал разные методы, не получается разобраться!