Closed nmehjabin closed 1 year ago
Could you make it a minimal repro (the smallest piece of code that reproduces your error)?
Hi @janosh , it might be related to my issue https://github.com/materialsproject/api/issues/814#event-9583619067
@munrojm Does this look like a dupe of #814? If so, @nmehjabin is the error still happening reliably?
Yes, this could be related to the server issues we have been dealing with. We are getting out a new deployment ASAP which will hopefully help with this.
Yes, this could be related to the server issues we have been dealing with. We are getting out a new deployment ASAP which will hopefully help with this.
I have went through the material project documentation and they have New API and Legacy API. I am trying to use New API on my projects and I have noticed that they have also changed their query style of writing. The recent bug that I am getting is that my API key works when I test it in https://api.materialsproject.org/docs#/Materials%20Summary/search_materials_summary_stats__get So it looks like my API key is working. However, when I try to run a snippet of code that has query with my API it gives an error.
from mp_api.client import MPRester with MPRester("A3gokBALO3E6mu2jZMDCcpB3MTGExf0v") as mpr: docs = mpr.materials.search(material_ids=["mp-149", "mp-13", "mp-22526"])
MPRestError: REST query returned with error status code 404 on URL https://api.materialsproject.org/materials/?material_ids=mp-149&material_ids=mp-13&material_ids=mp-22526&all_fields=True&limit=1000 with message: Not Found
@munrojm Does this look like a dupe of #814? If so, @nmehjabin is the error still happening reliably?
Yes.
Yes, this could be related to the server issues we have been dealing with. We are getting out a new deployment ASAP which will hopefully help with this.
Are you saying that it's something I should wait to fix the problem?
The 404 error can be resolved by updating your mp-api
package. Other timeout issues may be resolved in a day or two on our end.
I did pip install mp-api and used "from mp_api.client import MPRester" and I still get the same issues. Does it have to be with the query? Because previously when it was running, I used query() but now I saw in the documentation there were examples with "summary.search()" and "materials.search()". Thanks for the prompt response.
Shouldn't be the query. I can tell by the endpoint it is trying to ping in the error message that your client is out of date. What is the exact version of both python and mp-api that you are using? Have you tried running pip install mp-api --upgrade
?
Hi. I have updated my python version to 10 and I did pip install -U mp-api and the version shows mp-api==0.33.3. However, I am trying to run a piece of code to see if my API key works and grab the information from the database.
from mp_api.client import MPRester with MPRester(“MY_API_KEY”) as mpr: docs = mpr.materials.search(material_ids=[“mp-149”, “mp-13”, “mp-22526”])
MPRestError: REST query returned with error status code 404 on URL https://api.materialsproject.org/materials/?material_ids=mp-149&material_ids=mp-13&material_ids=mp-22526&all_fields=True&limit=1000 with message: Not Found
That version is correct, but the endpoint it is spitting out in the error still tells me it isn't updated in whatever environment you are running the code in. If it was running with the newest client, it would be trying to hit https://api.materialsproject.org/materials/core/...
and not https://api.materialsproject.org/materials/...
. Are you running this in a jupyter notebook?
Yes this is being run in a Jupyter notebook
Have you made sure the notebook kernel is refreshed and correctly pulling from the updated installation of python and mp-api
?
I fixed the issue. Thanks for all the help. I really appreciate.
No worries!
Please post the code you're running.