Time out error 504

Hello there,
I am trying to get the list of all ternary compounds available on MP. But my script stopped with the following error message:
pymatgen.ext.matproj.MPRestError: REST query returned with error status code 504.

Could you please let me know how I can fix this?

Best,
Hossein

Hi Hossein,

I suspect the issue is related to the query being a bit too heavy (there are a lot of ternary compounds on MP) and timing out, but can you paste a snippet of the code you’re using so I can make sure?

Hi Hossein,

504 is a timeout error. We have had short periods of time over the last few days where request load was particularly high – you may have caught one of these times. We’re looking into ways of ensuring more consistent performance. It looks like your query should work now. It may take a while to run, though:

from pymatgen import MPRester

mpr = MPRester()

material_ids = [d["material_id"] for d in mpr.query({"nelements": 3}, ["material_id"])]

Best,
Donny

Hi,
It was a temporary problem. Most probably due to high request load.
Thanks for your quick response.

Best,
Hossein