telepot 中的 bot.sendAudio 和 bot.sendPhoto 方法 return { 'error code' : 400 , 'Bad Request: wrong HTTP URL specified'}
bot.sendAudio and bot.sendPhoto methods in telepot return { 'error code' : 400 , 'Bad Request: wrong HTTP URL specified'}
我正在使用
telepot.Bot(bot_id).sendAudio(chat_id, file_url)
方法,应该是发送文件,但是returns
Traceback (most recent call last):
File "C:\Users\vinu\AppData\Local\Programs\Python\Python37\lib\site-packages\telepot\__init__.py", line 1158, in collector
callback(item)
File "bot.py", line 72, in handle
bot.sendAudio(chat_id, url)
File "C:\Users\vinu\AppData\Local\Programs\Python\Python37\lib\site-packages\telepot\__init__.py", line 556, in sendAudio
return self._api_request_with_file('sendAudio', _rectify(p), 'audio', audio)
File "C:\Users\vinu\AppData\Local\Programs\Python\Python37\lib\site-packages\telepot\__init__.py", line 496, in _api_request_with_file
return self._api_request(method, _rectify(params), **kwargs)
File "C:\Users\vinu\AppData\Local\Programs\Python\Python37\lib\site-packages\telepot\__init__.py", line 491, in _api_request
return api.request((self._token, method, params, files), **kwargs)
File "C:\Users\vinu\AppData\Local\Programs\Python\Python37\lib\site-packages\telepot\api.py", line 155, in request
return _parse(r)
File "C:\Users\vinu\AppData\Local\Programs\Python\Python37\lib\site-packages\telepot\api.py", line 150, in _parse
raise exception.TelegramError(description, error_code, data)
telepot.exception.TelegramError: ('Bad Request: wrong HTTP URL specified', 400, {'ok': False, 'error_code': 400, 'description': 'Bad Request: wrong HTTP URL specified'})
sendPhoto 也发生了同样的情况,但我使用 python 请求发送照片
response =
requests.post('https://api.telegram.org/bot/sendphoto', files=files`)
我要么想知道为什么 sendAudio() 和 sendPhoto() 方法有效,要么想知道 http url 发送音频的原因
with telepot bot.SendPhoto
and bot.sendVideo
and bot.sendAudio
work with files and urls that contains a file.
在你的情况下,你似乎使用了 url 但它是不正确的,你能分享一下吗?
根据我的经验,这可能是因为 url 包含 &
而不是 &
我正在使用
telepot.Bot(bot_id).sendAudio(chat_id, file_url)
方法,应该是发送文件,但是returns
Traceback (most recent call last):
File "C:\Users\vinu\AppData\Local\Programs\Python\Python37\lib\site-packages\telepot\__init__.py", line 1158, in collector
callback(item)
File "bot.py", line 72, in handle
bot.sendAudio(chat_id, url)
File "C:\Users\vinu\AppData\Local\Programs\Python\Python37\lib\site-packages\telepot\__init__.py", line 556, in sendAudio
return self._api_request_with_file('sendAudio', _rectify(p), 'audio', audio)
File "C:\Users\vinu\AppData\Local\Programs\Python\Python37\lib\site-packages\telepot\__init__.py", line 496, in _api_request_with_file
return self._api_request(method, _rectify(params), **kwargs)
File "C:\Users\vinu\AppData\Local\Programs\Python\Python37\lib\site-packages\telepot\__init__.py", line 491, in _api_request
return api.request((self._token, method, params, files), **kwargs)
File "C:\Users\vinu\AppData\Local\Programs\Python\Python37\lib\site-packages\telepot\api.py", line 155, in request
return _parse(r)
File "C:\Users\vinu\AppData\Local\Programs\Python\Python37\lib\site-packages\telepot\api.py", line 150, in _parse
raise exception.TelegramError(description, error_code, data)
telepot.exception.TelegramError: ('Bad Request: wrong HTTP URL specified', 400, {'ok': False, 'error_code': 400, 'description': 'Bad Request: wrong HTTP URL specified'})
sendPhoto 也发生了同样的情况,但我使用 python 请求发送照片
response =
requests.post('https://api.telegram.org/bot/sendphoto', files=files`)
我要么想知道为什么 sendAudio() 和 sendPhoto() 方法有效,要么想知道 http url 发送音频的原因
with telepot bot.SendPhoto
and bot.sendVideo
and bot.sendAudio
work with files and urls that contains a file.
在你的情况下,你似乎使用了 url 但它是不正确的,你能分享一下吗?
根据我的经验,这可能是因为 url 包含 &
而不是 &