D
D
Dunge12020-02-05 09:26:20
Python
Dunge1, 2020-02-05 09:26:20

How to upload a picture from a device to VK via vk_api in python?

In general, in the official documentation it is not very clear how to do this. I want to make quotes (you write to the bot and it gives out a picture with this text, there is a script.) But I just can’t figure out how to do it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
HemulGM, 2020-02-05
@Dunge1

Everything is clearly described there ( detailed instructions on VK )
First of all, you need to get the address of the server where you can upload the picture photos.getWallUploadServer
. Next, send the desired file to this server via Post. Files in the fields file/file1, file2 in the format The multipart/form-data
answer is returned to you in the form of an array with data about the uploaded photos photos_list. Then, you execute photos.saveby passing photos_listin the parameters.
An array of photos comes in response, from which you already take id, owner_id, access_key, if necessary, and send it as an attachment. Everything.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question