电报错误的URL主机

问题描述 投票:0回答:1

我正在制作机器人。我尝试了所有的东西,这是我的代码:

def send_photo(chat_id, location , reply_markup=None):
    url = URL + "sendPhoto?chat_id={}&photo={}".format(chat_id,open('1.jpg', 'rb'))
    if reply_markup:
        url += "&reply_markup={}".format(reply_markup)
    print(get_url(url))
    get_url(url)

我的文件在我的.py文件夹中,我仔细检查了每一件事,我甚至使用了照片telgram id和url,我仍然得到:

{"ok":false,"error_code":400,"description":"Bad Request: wrong URL host"}
python python-3.x telegram telegram-bot python-telegram-bot
1个回答
0
投票

请使用http url而不是local,它会工作,然后先上传文件,然后获取file_id然后将该文件ID发送到bot。

© www.soinside.com 2019 - 2024. All rights reserved.