Answer the question
In order to leave comments, you need to log in
How to send document vk api python?
Hello, I'm having a problem with uploading a document to private messages. I wanted to upload a database (sq3lite) to private messages, as I am doing an admin panel (there is a check for the administrator, if that helps). Maybe I messed something up or something else is interfering. Waiting for a reply from:
def baza(db):
a = vk.method("docs.getUploadServer")
b = requests.post(a['upload_url'], files={'doc': open('user.sqlite', 'rb')}).json()
c = vk.method('docs.getMessagesUploadServer', {'doc': b['doc'], 'server': b['server'], 'hash': b['hash']})[0]
d = "doc{}_{}".format(c["owner_id"], c["id"])
vk.method("messages.send", {"peer_id": id, "message": "Вот держи базу данных, создатель.", "attachment": d, "random_id": 0})
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