Skip to content

Commit

Permalink
fix: documentation for retry attribute (#1358)
Browse files Browse the repository at this point in the history
Co-authored-by: Julia Signell <jsignell@gmail.com>
  • Loading branch information
gadomski and jsignell authored Jul 16, 2024
1 parent 346ff74 commit d9b354d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pystac/stac_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ def read_json(self, source: HREF, *args: Any, **kwargs: Any) -> dict[str, Any]:

@staticmethod
def _report_duplicate_object_names(
object_pairs: list[tuple[str, Any]]
object_pairs: list[tuple[str, Any]],
) -> dict[str, Any]:
result: dict[str, Any] = {}
for key, value in object_pairs:
Expand Down Expand Up @@ -414,17 +414,16 @@ class RetryStacIO(DefaultStacIO):
"""

retry: Retry
"""The :py:class:`urllib3.util.retry.Retry` to use with all reading network
requests."""

def __init__(
self,
headers: dict[str, str] | None = None,
retry: Retry | None = None,
):
super().__init__(headers)

self.retry = retry or Retry()
"""The :py:class:`urllib3.util.retry.Retry` to use with all reading network
requests."""

def read_text_from_href(self, href: str) -> str:
"""Reads file as a UTF-8 string, with retry support.
Expand All @@ -438,7 +437,9 @@ def read_text_from_href(self, href: str) -> str:
http = PoolManager()
try:
response = http.request(
"GET", href, retries=self.retry # type: ignore
"GET",
href,
retries=self.retry, # type: ignore
)
return cast(str, response.data.decode("utf-8"))
except HTTPError as e:
Expand Down

0 comments on commit d9b354d

Please sign in to comment.