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

allow to write queryables #698

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

- Allow to write queryables [#698](https://github.com/stac-utils/pystac-client/pull/698)

### Removed

- Python 3.9 support [#724](https://github.com/stac-utils/pystac-client/pull/724)
Expand Down
13 changes: 13 additions & 0 deletions pystac_client/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,16 @@ def _get_queryables_href(self) -> str:
link = self.get_single_link(QUERYABLES_REL)
href = self._get_href(QUERYABLES_REL, link, QUERYABLES_ENDPOINT)
return href

def set_queryables(
self, queryables: Dict[str, Any], url: Optional[str] = None
) -> None:
"""Write a queryables to an endpoint.

Defaults to the queryables href as defined by the STAC API extension.
"""
if self._stac_io is None:
raise APIError("API access is not properly configured (`_stac_io` not set)")
if url is None:
url = self._get_queryables_href()
self._stac_io.save_json(url, queryables)
Loading
Loading