Skip to content

Commit

Permalink
ENH: Use the new RetrySession context manager. [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
Taher Chegini committed Sep 22, 2023
1 parent 2031c31 commit ae4013a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pygeohydro/pygeohydro.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def ssebopeta_bycoords(
f_list = helpers.get_ssebopeta_urls(dates)
session = RetrySession()

with patch("socket.has_ipv6", False):
with patch("socket.has_ipv6", False), RetrySession() as session:

def _ssebop(url: str) -> list[npt.NDArray[np.float64]]:
r = session.get(url)
Expand Down Expand Up @@ -216,8 +216,7 @@ def ssebopeta_bygeom(
raise InputTypeError("geometry", "(Multi)Polygon or tuple of length 4") from ex

gtiff2xarray = tlz.partial(geoutils.gtiff2xarray, geometry=geometry, geo_crs=geo_crs)
session = RetrySession()
with patch("socket.has_ipv6", False):
with patch("socket.has_ipv6", False), RetrySession() as session:

def _ssebop(t: pd.Timestamp, url: str) -> xr.DataArray:
resp = session.get(url)
Expand Down

0 comments on commit ae4013a

Please sign in to comment.