Skip to content

Commit dabade7

Browse files
author
Jon Duckworth
authored
Merge pull request #433 from duckontheweb/fix/411-read_json-args
Add args/kwargs to StacIO.read_json
2 parents 02d26d7 + 14522fc commit dabade7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
### Changed
1313

1414
- Package author to `stac-utils`, email to `stac@radiant.earth`, url to this repo ([#409](https://github.com/stac-utils/pystac/pull/409))
15+
- `StacIO.read_json` passes arbitrary positional and keyword arguments to
16+
`StacIO.read_text` ([#433](https://github.com/stac-utils/pystac/pull/433))
1517

1618
### Fixed
1719

pystac/stac_io.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ def stac_object_from_dict(
102102
result._stac_io = self
103103
return result
104104

105-
def read_json(self, source: Union[str, "Link_Type"]) -> Dict[str, Any]:
105+
def read_json(
106+
self, source: Union[str, "Link_Type"], *args: Any, **kwargs: Any
107+
) -> Dict[str, Any]:
106108
"""Read a dict from the given source.
107109
108110
See :func:`StacIO.read_text <pystac.StacIO.read_text>` for usage of
@@ -115,7 +117,7 @@ def read_json(self, source: Union[str, "Link_Type"]) -> Dict[str, Any]:
115117
dict: A dict representation of the JSON contained in the file at the
116118
given source.
117119
"""
118-
txt = self.read_text(source)
120+
txt = self.read_text(source, *args, **kwargs)
119121
return self._json_loads(txt, source)
120122

121123
def read_stac_object(

0 commit comments

Comments
 (0)