P
P
prostiim2020-08-30 16:07:24
Python
prostiim, 2020-08-30 16:07:24

Error when sending a document via VK API. What to do?

Hello!

I have this code:

s4 = requests.Session()
    params4 = {
        'chat_id': rg, #chat_id
        'message': msg3, #сообщение
        'access_token': token, #токен
        'random_id': 0,
        'attachment': doc1_2, #doc1_2 - Название документа
        'v': 5.122
    }
    s4.post('https://api.vk.com/method/messages.send', params=params4)

Task - Send document
Doesn't work for me, gives an error -
Traceback (most recent call last):
File "C:\Users\SosiSosok\Desktop\New folder\russilka.py", line 163, in
'attachment': doc1_2,

Sho make?

PS I uploaded the document itself and checked the title, everything matches!
NameError: name 'doc1_2' is not defined

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question