Skip to content

stac

STAC-specific utilities.

Get all links from a STAC response.

Source code in src/stac_auth_proxy/utils/stac.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
def get_links(data: dict) -> chain[dict]:
    """Get all links from a STAC response."""
    return chain(
        # Item/Collection
        data.get("links", []),
        # Collections/Items/Search
        (
            link
            for prop in ["features", "collections"]
            for object_with_links in data.get(prop, [])
            for link in object_with_links.get("links", [])
        ),
    )