Skip to content

Commit 3f8616e

Browse files
committed
update: get_collection no longer returns Optional
Previously Client.get_collection returned None if the requested collection was not found. Now it has been updated to raise an exception if the requested collection does not exist.
1 parent 980739b commit 3f8616e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pystac_client/client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,16 +336,17 @@ def _warn_about_fallback(self, *args: str) -> None:
336336
warnings.warn(FallbackToPystac(), stacklevel=2)
337337

338338
@lru_cache()
339-
def get_collection(
340-
self, collection_id: str
341-
) -> Optional[Union[Collection, CollectionClient]]:
339+
def get_collection(self, collection_id: str) -> Union[Collection, CollectionClient]:
342340
"""Get a single collection from this Catalog/API
343341
344342
Args:
345343
collection_id: The Collection ID to get
346344
347345
Returns:
348346
Union[Collection, CollectionClient]: A STAC Collection
347+
348+
Raises:
349+
NotFoundError if collection_id does not exist.
349350
"""
350351
collection: Union[Collection, CollectionClient]
351352

0 commit comments

Comments
 (0)