Skip to content

Commit 6ee11d3

Browse files
committed
Add parameters argument to Client.open and Client.from_file
1 parent 059307d commit 6ee11d3

File tree

3 files changed

+819
-11
lines changed

3 files changed

+819
-11
lines changed

pystac_client/client.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@ def __repr__(self):
2727
return '<Client id={}>'.format(self.id)
2828

2929
@classmethod
30-
def open(cls,
31-
url: str,
32-
headers: Dict[str, str] = None,
33-
ignore_conformance: bool = False) -> "Client":
30+
def open(
31+
cls,
32+
url: str,
33+
headers: Dict[str, str] = None,
34+
parameters: Optional[Dict[str, Any]] = None,
35+
ignore_conformance: bool = False,
36+
) -> "Client":
3437
"""Opens a STAC Catalog or API
3538
This function will read the root catalog of a STAC Catalog or API
3639
@@ -44,7 +47,7 @@ def open(cls,
4447
Return:
4548
catalog : A :class:`Client` instance for this Catalog/API
4649
"""
47-
cat = cls.from_file(url, headers=headers)
50+
cat = cls.from_file(url, headers=headers, parameters=parameters)
4851
search_link = cat.get_links('search')
4952
# if there is a search link, but no conformsTo advertised, ignore conformance entirely
5053
# NOTE: this behavior to be deprecated as implementations become conformant
@@ -54,17 +57,20 @@ def open(cls,
5457
return cat
5558

5659
@classmethod
57-
def from_file(cls,
58-
href: str,
59-
stac_io: Optional[pystac.StacIO] = None,
60-
headers: Optional[Dict] = {}) -> "Client":
60+
def from_file(
61+
cls,
62+
href: str,
63+
stac_io: Optional[pystac.StacIO] = None,
64+
headers: Optional[Dict] = {},
65+
parameters: Optional[Dict] = None,
66+
) -> "Client":
6167
"""Open a STAC Catalog/API
6268
6369
Returns:
6470
Client: A Client (PySTAC Catalog) of the root Catalog for this Catalog/API
6571
"""
6672
if stac_io is None:
67-
stac_io = StacApiIO(headers=headers)
73+
stac_io = StacApiIO(headers=headers, parameters=parameters)
6874

6975
cat = super().from_file(href, stac_io)
7076

0 commit comments

Comments
 (0)