I am trying to use the matminer data_retrieval method and I am encountering some errors which I don’t understand. I have successfully used the method to access data using an example I found:
For example:
from matminer.data_retrieval.retrieve_MPDS import MPDSDataRetrieval
MPDS_API_key = (actual key not included here)
mpdsdr = MPDSDataRetrieval(api_key=MPDS_API_key)df_mp = mpdsdr.get_dataframe(criteria={“elements”:“Ag-K”, “props”:‘heat capacity’})
This returns 6 entries in a dataframe as expected.
When I attempt to run another example
answer = mpdsdr.get_data(
{“elements”: “U-O”, “props”: “atomic structure”},
fields={‘S’:[‘phase_id’, ‘entry’, ‘chemical_formula’, ‘cell_abc’, ‘sg_n’, ‘setting’, ‘basis_noneq’, ‘els_noneq’]}
)
I receive the a rather unhelpful error of 402 and the following output
APIError Traceback (most recent call last)
/tmp/ipykernel_53785/1410175812.py in
----> 1 answer = mpdsdr.get_data(
2 {“elements”: “U-O”, “props”: “atomic structure”},
3 fields={‘S’:[‘phase_id’, ‘entry’, ‘chemical_formula’, ‘cell_abc’, ‘sg_n’, ‘setting’, ‘basis_noneq’, ‘els_noneq’]}
4 )
5/data/miniconda/envs/matminer/lib/python3.9/site-packages/matminer/data_retrieval/retrieve_MPDS.py in get_data(self, criteria, phases, fields)
245 result = self._request(criteria, phases=phases, page=counter)
246 if result[“error”]:
→ 247 raise APIError(result[“error”], result.get(“code”, 0))
248
249 if result[“npages”] > MPDSDataRetrieval.maxnpages:APIError: ‘HTTP error code 402’
Does anyone have an idea of what might be the problem. A functional example would be most useful.
While I am on the subject a couple of functional examples with AFLOWDataRetrieval would be appreciated as well. The above output was created using matminer 0.7.4