Проблема с 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
Car sales bot
25 USD
Need to write a Car Sales Bot Payment method from personal balance Top-up balance via TRC-20 network The bot should have three-level product categories Issue text files or images There should also be a feedback field and several buttons Propose a price, I will choose the most… Python, Bot development ∙ 3 proposals |
Recognition of the planI am interested in a program in Python or something else for recognizing apartment plans. The plan is in the form of a jpg or pdf file. An example is attached. The output should be a file in json format with the indication of wall coordinates (distances). Python, Machine learning ∙ 5 proposals |
Program for displaying MS PowerPoint inside a window
20 USD
A program needs to be developed for PC on Windows, inside which a PowerPoint window will open showing MS PowerPoint presentation files (extension ppsx). It is important that when ESC is pressed during viewing, a program window with confirmation buttons to end the viewing… C and C++, Python ∙ 1 proposal |
Need software for sending messages on Telegram or Viber.
637 USD
There is a database of phone numbers for which it is necessary to send messages in Viber or Telegram (it doesn't matter where, the main thing is that the software works and does not crash). No prepayments, payment either step by step or based on results. We are a large… Python, Web programming ∙ 14 proposals |
Python Django developer neededA Python Django developer with DevOps knowledge is needed to complete the project. Commands - not interested, we are specifically looking for a developer. Please mention your experience with Python Django and DevOps, the number of hours available per week, and your payment… DevOps, Python ∙ 7 proposals |