materialsproject / pymatgen

Python Materials Genomics (pymatgen) is a robust materials analysis code that defines classes for structures and molecules with support for many electronic structure codes. It powers the Materials Project.
https://pymatgen.org
Other
1.53k stars 867 forks source link

InsecurePlatformWarning for MPRester method #206

Closed dwinston closed 9 years ago

dwinston commented 9 years ago

Reproduction (using Python 2.7.8, pymatgen 3.0.13):

from pymatgen import MPRester
from os import environ
mpr = MPRester(environ['MAPI_KEY'])
my_bs = mpr.get_bandstructure_by_material_id('mp-754937')

Output:

/Users/dwinston/.virtualenvs/mp/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:79: 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. InsecurePlatformWarning

From the link above:

Certain Python platforms (specifically, versions of Python earlier than 2.7.9) have restrictions in their ssl module that limit the configuration that urllib3 can apply. In particular, this can cause HTTPS requests that would succeed on more featureful platforms to fail, and can cause certain security features to be unavailable.

If you encounter this warning, it is strongly recommended you upgrade to a newer Python version, or that you use pyOpenSSL as described in the OpenSSL / PyOpenSSL section.

Does this mean that users with Python < 2.7.9 (released 2014-12-10) will fail at making REST queries? The MP web site is running Python 2.7.8.

shyuep commented 9 years ago

As far as I know, this is not an issue yet. Not sure about future.