Error: MPRester.get_dos_by_material

from mp_api.client import MPRester
with MPRester(“api”) as mpr:
dos1 = mpr.get_dos_by_material_id(“mp-149”)

it is giving me error:
MPRestError: REST query returned with error status code 403 on URL https://api.materialsproject.org/materials/electronic_structure/mp-149/?_limit=1&_fields=dos with message: Response {“error”: “You are using deprecated API endpoints. Please read our documentation (https://docs.materialsproject.org) and upgrade to the latest version of the mp-api client (mp-api · PyPI).”, “version”: “blocked”}

I tried upgrading mp-api but didn’t resolve the issue.

Which version of mp-api are you running? Make sure it’s 0.40.0.

mp-api version: 0.39.5
mpcontribs-client version: 5.7.0

Hi I updated the version using pip install --upgrade mp-api==0.40.0. But when I check the version, it is still showing 0.39.5.

Make sure you’re in the right python environment, and restart your kernel if you’re running in a jupyter notebook


I am using python 3.11.4 and I also tried with restarting the kernel. But having the same error.