Python requests urllib3 SSL warning

My Linux development computers are still running Ubuntu 14.04 which includes Python 2.7.

One of the libraries I commonly use to access websites or APIs from Python is "Requests: HTTP for Humans". Requests in turn leverages urllib3.  The following warning began popping up a while ago when making requests to SSL sites:

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

The solution is actually quite simple (especially if one is developing in a virtual environment), using pip install with the extra bits including the brackets:

$ pip install urllib3[secure]

From:

https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl-py2

 

If you aren't developing in a python virtual environment... start developing in a pyton virtual environment! I suggest virtualenvwrapper over vanilla virtualenv.

https://virtualenvwrapper.readthedocs.io/en/latest/