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