Skip to content

Commit 9a6e128

Browse files
authored
Set the _stac_io on a collection client (#709)
* 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
1 parent 5d465da commit 9a6e128

File tree

5 files changed

+212
-5
lines changed

5 files changed

+212
-5
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Actually set `timeout` when initializing `StacApiIO` [#709](https://github.com/stac-utils/pystac-client/pull/709)
13+
- Set `_stac_io` on `CollectionClient` when reading [#709](https://github.com/stac-utils/pystac-client/pull/709)
14+
1015
## [v0.8.2] - 2024-05-30
1116

1217
### Added

pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,13 @@ ignore-path = "docs/_build,docs/tutorials"
9999
max-line-length = 130
100100

101101
[tool.ruff]
102-
ignore = ["E722", "E731"]
103102
line-length = 88
103+
104+
[tool.ruff.lint]
105+
ignore = ["E722", "E731"]
104106
select = ["E", "F", "W", "I"]
105107

106-
[tool.ruff.per-file-ignores]
108+
[tool.ruff.lint.per-file-ignores]
107109
"__init__.py" = ["F401"]
108110
"test_item_search.py" = ["E501"]
109111

pystac_client/stac_api_io.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ def __init__(
9696
self.session.mount("https://", HTTPAdapter(max_retries=max_retries))
9797
self.timeout = timeout
9898
self.update(
99-
headers=headers, parameters=parameters, request_modifier=request_modifier
99+
headers=headers,
100+
parameters=parameters,
101+
request_modifier=request_modifier,
102+
timeout=timeout,
100103
)
101104

102105
def update(
@@ -271,9 +274,17 @@ def stac_object_from_dict(
271274
return result
272275

273276
if info.object_type == pystac.STACObjectType.COLLECTION:
274-
return pystac_client.collection_client.CollectionClient.from_dict(
275-
d, href=str(href), root=root, migrate=False, preserve_dict=preserve_dict
277+
collection_client = (
278+
pystac_client.collection_client.CollectionClient.from_dict(
279+
d,
280+
href=str(href),
281+
root=root,
282+
migrate=False,
283+
preserve_dict=preserve_dict,
284+
)
276285
)
286+
collection_client._stac_io = self
287+
return collection_client
277288

278289
if info.object_type == pystac.STACObjectType.ITEM:
279290
return pystac.Item.from_dict(

0 commit comments

Comments
 (0)