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 APILayoutStrategy as fallback strategy #666

Merged
merged 4 commits into from
Apr 17, 2024
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

- Updated to **pystac** v1.10.0 [#661](https://github.com/stac-utils/pystac-client/pull/661)
- Use [uv](https://github.com/astral-sh/uv) for CI [#663](https://github.com/stac-utils/pystac-client/pull/663)
- use `APILayoutStrategy` as fallback strategy [#666](https://github.com/stac-utils/pystac-client/pull/666)

## [v0.7.6]

Expand Down
3 changes: 2 additions & 1 deletion pystac_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import pystac.utils
import pystac.validation
from pystac import CatalogType, Collection
from pystac.layout import HrefLayoutStrategy
from pystac.layout import APILayoutStrategy, HrefLayoutStrategy
from requests import Request

from pystac_client._utils import Modifiable, call_modifier
Expand Down Expand Up @@ -62,6 +62,7 @@ class Client(pystac.Catalog, QueryablesMixin):
"""

_stac_io: Optional[StacApiIO]
_fallback_strategy: HrefLayoutStrategy = APILayoutStrategy()

def __init__(
self,
Expand Down
5 changes: 3 additions & 2 deletions pystac_client/collection_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
)

import pystac
import pystac.layout
from pystac.layout import APILayoutStrategy, HrefLayoutStrategy

from pystac_client._utils import Modifiable, call_modifier
from pystac_client.conformance import ConformanceClasses
Expand All @@ -33,6 +33,7 @@
class CollectionClient(pystac.Collection, QueryablesMixin):
modifier: Callable[[Modifiable], None]
_stac_io: StacApiIO
_fallback_strategy: HrefLayoutStrategy = APILayoutStrategy()

def __init__(
self,
Expand All @@ -49,7 +50,7 @@ def __init__(
providers: Optional[List[pystac.Provider]] = None,
summaries: Optional[pystac.Summaries] = None,
assets: Optional[Dict[str, pystac.Asset]] = None,
strategy: Optional[pystac.layout.HrefLayoutStrategy] = None,
strategy: Optional[HrefLayoutStrategy] = None,
*,
modifier: Optional[Callable[[Modifiable], None]] = None,
**kwargs: Dict[str, Any],
Expand Down
Loading