I'm tiring to send some files to telegram, but the program receives the errors 404.
This is my code:
import json
import requests
chat_id ="-"
TOKEN = "--"
data = {
"chat_id": chat_id,
"document": json.dumps([
{"type": "document", "document":"attach:path_to_file"},
{"type": "document", "document":"attach:path_to_file"}
# paths are like C:\\a\\b\\c\\d.jpg
])
}
files = {
"photo1.png" : open("path_to_file", 'rb'),
"photo2.png" : open("path_to_file", 'rb')
}
temp = requests.post("https://api.telegram.org/bot" + TOKEN + "/sendDocumentGroup", data=data, files=files)
print(temp.json())
The error appears as below:
{'ok': False, 'error_code': 404, 'description': 'Not Found'}