Forums

SNIMissingWarning

hello, i want to code a python telegram bot and run my code on PythonAnyWhere servers. for that, first i clone module python-telegram-bot from github with this commands:

$ git clone https://github.com/python-telegram-bot/python-telegram-bot --recursive

$ cd python-telegram-bot

$ python setup.py install --user

after that i tried run a simple bot in example folder called conversationbot.py through this commands:

$ cd examples

$ python conversationbot.py

but i receive this warning and errors:

/home/Ehsaniton/.local/lib/python2.7/site-packages/python_telegram_bot-10.1.0-py2.7.egg/telegram/vendor/ptb_urllib3/urllib3/util/ssl_.py:334: SNIMissingWarning: An HTT
PS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect T
LS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.
io/en/latest/advanced-usage.html#ssl-warnings

  SNIMissingWarning


/home/Ehsaniton/.local/lib/python2.7/site-packages/python_telegram_bot-10.1.0-py2.7.egg/telegram/vendor/ptb_urllib3/urllib3/util/ssl_.py:132: InsecurePlatformWarning: 
A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a
 newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecurePlatformWarning

Note1: i have set correct Token in conversationbot.py Bot.

Note2: in local server (my PC) this module and code Run without problems.

That error is related to the version of Python 2.7 that we currently have installed; it's normally something you can ignore, but if the code you're running is compatible with Python 3, then the best solution is to run it using that Python version -- for example,

$ python3.6 conversationbot.py