Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for selecting the search endpoint using media_type #142

Merged
merged 12 commits into from
Apr 19, 2022
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added

- `Client.search` accepts an optional `filter_lang` argument for `filter` requests [#128](https://github.com/stac-utils/pystac-client/pull/128)
- Added support for filtering the search endpoint using the `media_type` in `Client.open` [#142](https://github.com/stac-utils/pystac-client/pull/142)

### Fixed
- Values from `parameters` and `headers` arguments to `Client.open` and `Client.from_file` are now also used in requests made from `CollectionClient` instances
Expand Down
5 changes: 2 additions & 3 deletions pystac_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def open(
catalog : A :class:`Client` instance for this Catalog/API
"""
cat = cls.from_file(url, headers=headers, parameters=parameters)
search_link = cat.get_links('search')
search_link = cat.get_links('search', media_type=pystac.MediaType.GEOJSON)
# if there is a search link, but no conformsTo advertised, ignore conformance entirely
# NOTE: this behavior to be deprecated as implementations become conformant
if ignore_conformance or ('conformsTo' not in cat.extra_fields.keys()
Expand Down Expand Up @@ -168,8 +168,7 @@ def search(self, **kwargs: Any) -> ItemSearch:
<https://github.com/radiantearth/stac-api-spec/tree/master/item-search>`__ or does not have a link with
a ``"rel"`` type of ``"search"``.
"""

search_link = self.get_single_link('search')
search_link = self.get_single_link('search', media_type=pystac.MediaType.GEOJSON)
if search_link is None:
raise NotImplementedError(
'No link with "rel" type of "search" could be found in this catalog')
Expand Down