Python-telegram-bot: SNIMissingWarning, InsecurePlatformWarning on urllib3 when using < Python 2.7.9

Created on 12 Jul 2016  路  4Comments  路  Source: python-telegram-bot/python-telegram-bot

Steps to reproduce

  1. run echobot.py on python < 2.7.9

    Expected behaviour

It's working as intended

Actual behaviour

Got warnings from urllib3: SNIMissingWarning, InsecurePlatformWarning

Configuration

Operating System:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.4 LTS
Release: 14.04
Codename: trusty

Version of Python:

Python 2.7.6

Version of python-telegram-bot:

4.3.3

Logs

/home/leandrotoledo/workspace/fisl-17-telegram-bot-com-python/python/env/local/lib/python2.7/site-packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS 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 TLS 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/security.html#snimissingwarning.

/home/leandrotoledo/workspace/fisl-17-telegram-bot-com-python/python/env/local/lib/python2.7/site-packages/urllib3/util/ssl_.py:122: 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/security.html#insecureplatformwarning.


Some options, per https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings

  • Disable warnings
  • Capture warnings and log them on DEBUG
  • Use pyOpenSSL
enhancement wontfix

Most helpful comment

Same happend with me, I solved try installing

pip install 'requests[security]'

source : http://stackoverflow.com/questions/29099404/ssl-insecureplatform-error-when-using-requests-package

All 4 comments

Same happend with me, I solved try installing

pip install 'requests[security]'

source : http://stackoverflow.com/questions/29099404/ssl-insecureplatform-error-when-using-requests-package

Let's leave the warnings as they are: they explain what's going on and guide the user to possible solutions. The best solution for them is to upgrade Python.

when you do 'import urllib3 '
do 'import urllib3'
and then type
'urllib3.disable_warnings()'

@bestofg -- Doesn't seem to have any effect.

$ sudo pip install urllib3 --upgrade
Downloading/unpacking urllib3 from https://pypi.python.org/packages/24/53/f397db567de0aa0e81b211d81c13c41a779f14893e42189cf5bdb97611b2/urllib3-1.21.1-py2.py3-none-any.whl#md5=b83ea4ad4905f6f0ca432b0db829a80b
  Downloading urllib3-1.21.1-py2.py3-none-any.whl (131kB): 131kB downloaded
Installing collected packages: urllib3
  Found existing installation: urllib3 1.7.1
    Not uninstalling urllib3 at /usr/lib/python2.7/dist-packages, owned by OS
Successfully installed urllib3
Cleaning up...
$ sudo pip install urllib3[secure] --upgrade
Requirement already up-to-date: urllib3[secure] in /usr/local/lib/python2.7/dist-packages
  Installing extra requirements: 'secure'
Cleaning up...

Then:

    import urllib3
    urllib3.disable_warnings()
     ... 

... still gives the warnings:

/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:335: SNIMissingWarning: An HTTPS 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 TLS 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

and

/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:133: 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
Was this page helpful?
0 / 5 - 0 ratings

Related issues

rchovan picture rchovan  路  4Comments

EvertKors picture EvertKors  路  4Comments

s-chizhik picture s-chizhik  路  4Comments

mzsalam picture mzsalam  路  5Comments

bvanrijn picture bvanrijn  路  4Comments