Skip to content

LocalitiesAgeRetriever

CorylC edited this page May 2, 2024 · 2 revisions

LocalitiesAgesRetriever Class Documentation

Overview

The LocalitiesAgeRetriever 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 LocalitiesAgeRetriever class and use its methods to set up your search and retrieve data.

Example

from openmindat import LocalitiesAgeRetriever

lar = LocalitiesAgeRetriever()
lar.page(4).saveto("/path/to/directory", "Page4_localities_age")

Methods

page(PAGE)

Sets the page number for paginated results.

  • Parameters:
    • PAGE (int): The page number.
  • Example Usage:
    lar.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:
    lar.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