Skip to content

LocalitiesTypeRetriever

CorylC edited this page May 2, 2024 · 2 revisions

LocalitiesTypeRetrieverClass Documentation

Overview

The LocalitiesTypeRetriever class in the openmindat package is designed for querying locality data from the Mindat API. The class supports method chaining for flexible query building and provides functionalities to save the queried data.

Usage

Create an instance of the LocalitiesTypeRetriever class and use its methods to set up your search and retrieve data.

Example

from openmindat import LocalitiesTypeRetriever

ltr = LocalitiesTypeRetriever()
ltr.page(9).saveto("/path/to/directory", "page9_locType")

Methods

page(PAGE)

Sets the page number for paginated results.

  • Parameters:
    • PAGE (int): The page number.
  • Example Usage:
    Ltr.page(2)

page_size(PAGE_SIZE)

Sets the number of results per page.

  • Parameters:
    • PAGE_SIZE (int): The number of results per page.
  • Example Usage:
    Ltr.page_size(50)

saveto(OUTDIR, FILE_NAME)

Executes the query and saves the results to a specified directory.

  • OUTDIR (str): Directory path.
  • FILE_NAME (str): file name.
  • Returns: None

save(FILE_NAME)

Executes the query and saves the results to the current directory.

  • FILE_NAME (str): file name
  • Returns: None

get_dict()

Executes the query and saves the results to an object.

  • Returns: Dictionary

Additional Information

For more details, please refer to the Mindat API documentation.

Back to Top