Issue querying the API seemingly caused by false deprecation

What I am trying to do:
Query 11k entries by mpid using a try / except statement to grab updated mpids where they have been deprecated.

My code:

    with MPRester(conditions["MP_API_key"]) as mpr:
        try:
            pmg_entry = mpr.get_entry_by_material_id(mpid)
        except:
            mpid_new = mpr.get_materials_id_from_task_id(mpid)
            pmg_entry = mpr.get_entry_by_material_id(mpid_new)

The problem
For ~400 entries, the try statement fails, and mpid_new = mpr.get_materials_id_from_task_id(mpid) points to the same mpid so the second query fails. I sampled 20 failed ids and searched for them with the materials explorer they show as
(1) deprecated on the old website https://materialsproject.org/materials/mp-1104462/
(2) perfectly available on the nextgen site. https://next-gen.materialsproject.org/materials/mp-1104462

Any advice / suggestions? Thank you in advance for your help! I am happy to clarify / provide more examples.

Hi @bwander, can I ask which MPRester you are trying to use? Is it the new one or the legacy one? The updated data seen on next-gen is only available through the new client.

– Jason

Hello @munrojm, I am using the legacy one. I am actually not sure how to use the next-gen one. The materials I am trying to query we had queried previously in ~2020, so I am confused why they only appear in the next gen website. Do you know why that would be?

@bwander, the one new database release on next-gen fixes a bunch of issues, resulting in a number of deprecated materials now being undeprecated. My suggestion would be to try using the new client and see if that fixes your issue. You can following the instructions here: Materials Project - API.

– Jason

@munrojm okay great! Thank you very much!