Проблема с WEBHOOK в телеграмм боте на python 3.6
Есть телеграмм бот на python 3.6 с использованием вебхуков, использую telebot, aiohttp. Код который создает вебхук и запускает сервер:
API_TOKEN = <token>
WEBHOOK_HOST = 'ip'
WEBHOOK_PORT = # 443, 80, 88 or 8443 (port need to be 'open')
WEBHOOK_LISTEN = 'ip' # In some VPS you may need to put here the IP addr
WEBHOOK_SSL_CERT = 'path_to_cert/webhook_cert.pem' # Path to the ssl certificate
WEBHOOK_SSL_PRIV = 'path_to_cert/webhook_pkey.pem' # Path to the ssl private key
WEBHOOK_URL_BASE = "https://{}:{}".format(WEBHOOK_HOST, WEBHOOK_PORT)
WEBHOOK_URL_PATH = "/{}/".format(API_TOKEN)
bot = telebot.TeleBot(API_TOKEN)
app = web.Application()
home = os.path.abspath(os.path.dirname(sys.argv[0]))
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
context.load_cert_chain(WEBHOOK_SSL_CERT, WEBHOOK_SSL_PRIV)
app.router.add_post('/{token}/', handle)
bot.remove_webhook()
# Set webhook
bot.set_webhook(url=WEBHOOK_URL_BASE + WEBHOOK_URL_PATH, certificate=open(WEBHOOK_SSL_CERT, 'r'))
web.run_app(
app,
host=WEBHOOK_LISTEN,
port=WEBHOOK_PORT,
ssl_context=context,
)
После запуска работает примерно пол дня - день. Потом падает с ошибкой
> "SSL error {error:1416F086:SSL
> routines:tls_process_server_certificate:certificate verify failed} "
Сертификаты использовал самоподписные. Пробовал вместо ip домен использовать, чтобы подтянулись сертификаты домена, не помогло. Пробовал разные порты, регистрировать самоподписный сертификат на телеграмм api через curl и @ перед именем сертификата. До этого работало с самоподписными около двух недель, перегенерил после возникновения ошибки, все равно вылетает часто.
Нужно удаленно по тимвьювер подключиться и помочь решить этот вопрос
Пишите только если есть реальный опыт работы
Current freelance projects in the category Python
Find a product feed (Google Merchant XML) for a website on OpenCart
16 USD
It is necessary to find a direct link to the active product feed (XML) of a competitor for Google Merchant Center Platform (CMS): OpenCart / ocStore Find the original feedRequirements for the result: Working link to the XML file Python, Data Parsing ∙ 1 hour 35 minutes back ∙ 13 proposals |
Development of a TikTok farm (content factory)It is necessary to develop a system for centralized management of multiple TikTok accounts with automatic content publishing, using individual proxies and simulating natural account activity. Functional Requirements1. Account Management Adding and removing TikTok accounts.… Python, Bot Development ∙ 13 hours 1 minute back ∙ 11 proposals |
Improve the performance of Claude Code and work on software development.I am currently developing CRM and Analytics software. I am using Claude Code, but I understand that the results are not the best in terms of changes. There are 2 tasks - Need help creating a preset for skills, MD, and so on to improve quality. Take verified ones that have been… AI & Machine Learning, Python ∙ 19 hours 35 minutes back ∙ 21 proposals |
OCR systemA system for recognizing text on postal envelopes (index for whom - only numbers). The text can sometimes be handwritten. Recognition of stamps (counting quantity and denomination) Python ∙ 22 hours 46 minutes back ∙ 20 proposals |
Looking for a white-label solution for a betting company for rent. |