InsecurePlatformWarning: A true SSLContext object is not available

I was using Python’s Requests module at a recent client engagement. I and ran into this error:

requests/packages/urllib3/util/ssl_.py:100: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.

What worked for me was to do this:

pip install requests[security]

To add this to your requirements.txt on GitHub

requests[security]==2.8.1

I typed this up because I noticed there are a few of other workarounds listed on the Internet – including upgrading your Python version (recommended if possible), installing PyOpenSSL and even downgrading(?!) your Requests version to suppress the warning.


Leave a Reply

Your email address will not be published.