How can I get the DOS file from a material?

Dear all,
I would like to download the DOS file for a material via my API key. The module itself works and I can get a response, for example using “mpr.materials.search()”. However, when I use the code below, which I got from the examples page (Examples | Materials Project Documentation), it shows me an error:

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 (https://pypi.org/project/mp-api/).", "version": "blocked"}"

code:

from mp_api.client import MPRester
with MPRester(api_key="KEY") as mpr:
    data = mpr.get_dos_by_material_id("mp-985592")

The material ID definitely has the data on the page. Any help would be highly appreciated. Thank you and best regards

Hi @Rene_Rekers, please make sure to upgrade to the latest version of mp-api (currently 0.41.2).