D
D
Dunge2020-02-05 11:37:19
Python
Dunge, 2020-02-05 11:37:19

It is not possible to send a picture to the VK server via vk_api in Python. What to do?

It is not possible to get the hash and the server, because after the POST request it will not display it, but writes
RESPONSE <200>
The code itself:

elif event.text == '!тест':
 data = vk.photos.getMessagesUploadServer(peer_id = event.peer_id)
 upload_url = data['upload_url']
 img = {'photo': ('blank.jpg', open(r'/sdcard/Download/blank.jpg', 'rb'))}
 request = requests.post(upload_url, files = img)
 print(request)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2020-02-05
@Dunge

Well, yes, the request itself will display only the response code
. What's in
request.headers
request.text
?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question