Answer the question
In order to leave comments, you need to log in
The vk_api picture is not sent to python. What to do?
I made a script to send a picture from the device, but only my message is sent, what should I do?
The script 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.text)
result = json.loads(request.text)
server = result['server']
photo = result['photo']
hash = result['hash']
sphoto = vk.photos.saveMessagesPhoto(server = server, photo = photo, hash = hash)
vk.messages.send(peer_id = event.peer_id, random_id = 0, message = str(''), attachment = sphoto)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question