Skip to content

Commit b1743ff

Browse files
committed
Propegate timeout parameter to required locations and add documentation
1 parent 4906448 commit b1743ff

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

pystac_client/client.py

+4
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ def open(
147147
stac_io: A `StacApiIO` object to use for I/O requests. Generally, leave
148148
this to the default. However in cases where customized I/O processing
149149
is required, a custom instance can be provided here.
150+
timeout: Optional float or (float, float) tuple following the semantics
151+
defined by `Requests
152+
<https://requests.readthedocs.io/en/latest/api/#main-interface>`__.
150153
151154
Return:
152155
catalog : A :class:`Client` instance for this Catalog/API
@@ -206,6 +209,7 @@ def from_file( # type: ignore
206209
headers=headers,
207210
parameters=parameters,
208211
request_modifier=request_modifier,
212+
timeout=timeout,
209213
)
210214

211215
client: Client = super().from_file(href, stac_io)

pystac_client/stac_api_io.py

+5
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def update(
8383
headers: Optional[Dict[str, str]] = None,
8484
parameters: Optional[Dict[str, Any]] = None,
8585
request_modifier: Optional[Callable[[Request], Union[Request, None]]] = None,
86+
timeout: Timeout = None,
8687
) -> None:
8788
"""Updates this StacApi's headers, parameters, and/or request_modifer.
8889
@@ -94,10 +95,14 @@ def update(
9495
objects before they are sent. If provided, the callable receives a
9596
`request.Request` and must either modify the object directly or return
9697
a new / modified request instance.
98+
timeout: Optional float or (float, float) tuple following the semantics
99+
defined by `Requests
100+
<https://requests.readthedocs.io/en/latest/api/#main-interface>`__.
97101
"""
98102
self.session.headers.update(headers or {})
99103
self.session.params.update(parameters or {}) # type: ignore
100104
self._req_modifier = request_modifier
105+
self.timeout = timeout
101106

102107
def read_text(self, source: pystac.link.HREF, *args: Any, **kwargs: Any) -> str:
103108
"""Read text from the given URI.

0 commit comments

Comments
 (0)