我如何发送一个视频和python电报频道吗?



如何用python发送视频到电报频道?我有一个机器人,并加入了我的频道!

def upload_video(title, desc):
bot_token = 'my token'
bot_chatID = '@PinkPanthersShow'
files = {'document': (f'{title}.mp4', open(f'{title}.mp4', 'rb'), 'video')}
data = {'chat_id': (f"{bot_chatID}", 'video')}
send_document = 'https://api.telegram.org/bot' + bot_token
r = requests.post(send_document,json=data,files=files)
print(r.url)
return r.json()

我的代码是这样的,但是我不能发送视频!帮帮我!

代码:

def upload_video(file_path):
bot_token = 'YOUR_TOKEN'
bot_chatID = '@PinkPanthersShow'
files = {'document': open(file_path,'rb')}
data = {'chat_id': bot_chatID}
method = 'sendDocument'
url = f'https://api.telegram.org/bot{bot_token}/{method}'

r = requests.post(url,data=data,files=files)
print(r.url)
return r.json()