Skip to content

Documentation for Collection Services

Bases: ServiceQuery

A Service client for NASA CMR that returns data on collection services.

Api

https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html#service

Build an instance of DataService to query CMR.

auth is an optional parameter for queries that need authentication, e.g. restricted datasets.

Parameters:

Name Type Description Default
auth Optional[Auth]

An authenticated Auth instance.

None
Source code in earthaccess/services.py
def __init__(self, auth: Optional[Auth] = None, *args: Any, **kwargs: Any) -> None:
    """Build an instance of DataService to query CMR.

    auth is an optional parameter for queries that need authentication,
    e.g. restricted datasets.

    Parameters:
        auth: An authenticated `Auth` instance.
    """
    super().__init__(*args, **kwargs)
    self._debug = False

    # To search, we need the new bearer tokens from NASA Earthdata
    self.session = (
        auth.get_session(bearer_token=True)
        if auth is not None and auth.authenticated
        else requests.sessions.Session()
    )

get(limit=2000)

Get all service results up to some limit.

Parameters limit (int): The number of results to return

Returns:

Type Description
List

Query results as a list

Source code in earthaccess/services.py
def get(self, limit: int = 2000) -> List:
    """Get all service results up to some limit.

    Parameters
        limit (int): The number of results to return

    Returns:
        Query results as a list
    """
    return search.get_results(self.session, self, limit)