Skip to content

Commit

Permalink
Set the _stac_io on a collection client (#709)
Browse files Browse the repository at this point in the history
* fix: pass timeout to update

Without this fix, we couldn't actually initialize with a timeout.

* fix: set _stac_io on collection client

* fix: typing, some config
  • Loading branch information
gadomski authored Jul 1, 2024
1 parent 5d465da commit 9a6e128
Show file tree
Hide file tree
Showing 5 changed files with 212 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed

- Actually set `timeout` when initializing `StacApiIO` [#709](https://github.com/stac-utils/pystac-client/pull/709)
- Set `_stac_io` on `CollectionClient` when reading [#709](https://github.com/stac-utils/pystac-client/pull/709)

## [v0.8.2] - 2024-05-30

### Added
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,13 @@ ignore-path = "docs/_build,docs/tutorials"
max-line-length = 130

[tool.ruff]
ignore = ["E722", "E731"]
line-length = 88

[tool.ruff.lint]
ignore = ["E722", "E731"]
select = ["E", "F", "W", "I"]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
"test_item_search.py" = ["E501"]

Expand Down
17 changes: 14 additions & 3 deletions pystac_client/stac_api_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ def __init__(
self.session.mount("https://", HTTPAdapter(max_retries=max_retries))
self.timeout = timeout
self.update(
headers=headers, parameters=parameters, request_modifier=request_modifier
headers=headers,
parameters=parameters,
request_modifier=request_modifier,
timeout=timeout,
)

def update(
Expand Down Expand Up @@ -271,9 +274,17 @@ def stac_object_from_dict(
return result

if info.object_type == pystac.STACObjectType.COLLECTION:
return pystac_client.collection_client.CollectionClient.from_dict(
d, href=str(href), root=root, migrate=False, preserve_dict=preserve_dict
collection_client = (
pystac_client.collection_client.CollectionClient.from_dict(
d,
href=str(href),
root=root,
migrate=False,
preserve_dict=preserve_dict,
)
)
collection_client._stac_io = self
return collection_client

if info.object_type == pystac.STACObjectType.ITEM:
return pystac.Item.from_dict(
Expand Down
Loading

0 comments on commit 9a6e128

Please sign in to comment.