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.
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.
Reproduction (using Python 2.7.8, pymatgen 3.0.13):
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:
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.