ChuBL/OpenMindat

FEATURE REQUEST: Retrieval without writing to file

Closed this issue · 2 comments

So far as I can tell, the library requires any requests to be saved to a file in order to retrieve the data. It would be much more helpful if results could be retrieved as a function result or, ideally, an iterable list of model objects or dicts.

You are right. In our next update, we will provide the option to return the retrieved data as a JSON object instead of saving it.

Thank you for the request. We have added this feature in our v0.0.4.
Please try it in your query by calling our get_list() function instead of save().

from openmindat import GeomaterialSearchRetriever

gsr = GeomaterialSearchRetriever()
gsr.geomaterials_search("quartz, green, hexagonal")
gsr.save("filename")

# Alternatively, you can get the list object directly:
gsr = GeomaterialSearchRetriever()
gsr.geomaterials_search("ruby, red, hexagonal")
print(gsr.get_list())