0

I'm trying to interact with Python and a telegram bot. I have a running script in a ubuntu 20.04 server which until a few hours ago was working smoothly, but suddenly stopped due to the following

Traceback (most recent call last):
  File "/home/pablo/Escritorio/Valuebets3/Telegram.py", line 26, in SendLog
    gvb.updater.bot.send_message(chat_id=chat_debug,text=message,parse_mode=telegram.ParseMode.HTML)
  File "/home/pablo/.local/lib/python3.8/site-packages/telegram/bot.py", line 127, in decorator
    result = func(*args, **kwargs)
  File "/home/pablo/.local/lib/python3.8/site-packages/telegram/bot.py", line 475, in send_message
    return self._message(  # type: ignore[return-value]
  File "/home/pablo/.local/lib/python3.8/site-packages/telegram/bot.py", line 296, in _message
    result = self._post(endpoint, data, timeout=timeout, api_kwargs=api_kwargs)
  File "/home/pablo/.local/lib/python3.8/site-packages/telegram/bot.py", line 259, in _post
    return self.request.post(
  File "/home/pablo/.local/lib/python3.8/site-packages/telegram/utils/request.py", line 349, in post
    result = self._request_wrapper(
  File "/home/pablo/.local/lib/python3.8/site-packages/telegram/utils/request.py", line 258, in _request_wrapper
    raise NetworkError(f'urllib3 HTTPError {error}') from error
telegram.error.NetworkError: urllib3 HTTPError [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1131)

I'm doing as follows

from telegram.ext import *
import telegram

token='1743294376:PPG4tfJ4FF9dK5rH8Vq7V89vuP9as8zxoXA'  #This is a fake token

updater=Updater(token=token,use_context=True)

updater.bot.send_message(chat_id=chat_debug,text=message,parse_mode=telegram.ParseMode.HTML)

If I ask about details I get

python3 -m telegram

python-telegram-bot 13.4.1
Bot API 5.1
certifi 2022.12.07
Python 3.8.10 (default, Nov 14 2022, 12:59:47)  [GCC 9.4.0]

I have never installed anything related to certificates. What should I do?

UPDATE:

If I try to poll the telegram api directly in Firefox it also say that the connection is not safe, so somehow at some point the Ubuntu mahcine has lost that certificate.

puppet
  • 707
  • 3
  • 16
  • 33
  • Hey, maybe this can help you: https://stackoverflow.com/questions/18061640/ignore-certificate-validation-with-urllib3/18062293#18062293 or maybe this one: https://stackoverflow.com/questions/61336180/ssl-certificate-verify-failed-error-in-my-python-telegram-bot – Anuj Panchal Jan 27 '23 at 01:38
  • @AnujPanchal but doesn't that just turn off all ssl verifications? I mean, if I have no other option ok, but I wishto know why it suddenly stopped working – puppet Jan 27 '23 at 09:14

0 Answers0