How can I obtain a mass of mp-id's property through ”MPRester()“or ”requsets()“ more quickly?

This qustion is copied from How can I obtain a mass of mp-id's property through ”MPRester()“or ”requsets()“ more quickly? · Issue #25 · materialsproject/mapidoc · GitHub
Dear
I have a list of mp_id which is named as mp_list and is about 40k entries. The code can be formulated as:

for i, mp_id in enumerate(tqdm(mp_list)):
  With open MPRester(API_KEY) as m:
    crystal_info = m.get_doc(mp_id) 

It did work and took about few hours, last month. But when I retried yesterday, it no longer worked, and would take me a about 300+ hours. Besides, when the progress bar reached about 2k/40k, the request was denied. So, I think whether any error ocurred when I need to obtain a large batch of mp_id’s data using the code? This problem has been bothering me for days. I would be appreciated if you can give me some advice about it.

Hi @yuwang, have you tried the new API? There is a material_ids field that you can pass your list to in the query method of the new MPRester class. You can check out Materials Project - API for more details about how to use the new API.

Please let us know how it works for you if you do end up trying it.

– Jason