не работает webhook aiogram
Вот такой код
from aiogram.utils import executor
from aiogram import Bot, Dispatcher
from aiogram.contrib.fsm_storage.memory import MemoryStorage
from aiogram.types import InputFile
from bot.misc import TOKEN, WEBHOOK_HOST, WEBHOOK_PATH, WEBHOOK_URL, WEBAPP_PORT, WEBAPP_HOST
from bot.handlers import register_all_handlers
'''
WEBHOOK_HOST = 'https://xxxxxxxxx.ru'
WEBHOOK_PATH = f'/webhook/<токен бота>'
WEBHOOK_URL = WEBHOOK_HOST + WEBHOOK_PATH
WEBAPP_HOST = x.x.x.x
WEBAPP_PORT = 443
'''
bot = Bot(token=TOKEN, parse_mode='HTML')
storage = MemoryStorage()
dp = Dispatcher(bot, storage=storage)
async def __on_start_up(dp: Dispatcher) -> None:
register_all_handlers(dp)
await bot.set_webhook(WEBHOOK_URL, certificate=InputFile('bot/certs/cert.pem'))
info = await bot.get_webhook_info()
print(info)
async def __on_shut_down(dp: Dispatcher):
await bot.delete_webhook()
await dp.storage.close()
await dp.storage.wait_closed()
def start_bot():
executor.start_webhook(
dispatcher=dp,
webhook_path=WEBHOOK_PATH,
on_startup=__on_start_up,
on_shutdown=__on_shut_down,
skip_updates=True,
host=WEBAPP_HOST,
port=WEBAPP_PORT
)
getWebhookInfo выдаёт это
SSL error {error:0A00010B:SSL routines::wrong version number}
при отправке сообщения боту в консоли выдаёт следующее:
Error handling request
Traceback (most recent call last):
File "/root/bots/scally_milano/venv/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 332, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"
Подскажите, пожалуйста, как сделать так, чтобы вебхук работал