504 Gateway Time-out

I tried to query the data from MP using MPRester, but ran into this issue below.

raise MPRestError(msg)
pymatgen.ext.matproj.MPRestError: REST query returned with error status code 504. Content: b’\r\n504 Gateway Time-out\r\n\r\n

504 Gateway Time-out

\r\n
nginx\r\n\r\n\r\n’

The funny thing is that two days ago it was working!

from pymatgen.ext.matproj import MPRester

api_key = “my_api_key”

m = MPRester(api_key)

material_id = “mp-1056702”

#material_id = “mp-12345” # Replace this with the actual material ID of the structure you want to retrieve

structure = m.get_structure_by_material_id(material_id)

Hi @Celso_Rego,

are you using a legacy API key by any chance? If so, try updating your API key with the one for our new API (see Materials Project - API). It looks like the system that our legacy servers run on at NERSC was in a degraded state between midnight and 6am today.

HTH
Patrick

Hi @tschaume, yes, that is right, I was using legacy API, but I think the servers are already back. Thanks for your tip!

1 Like