Skip to content

Commit ae4013a

Browse files
author
Taher Chegini
committed
ENH: Use the new RetrySession context manager. [skip ci]
1 parent 2031c31 commit ae4013a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

pygeohydro/pygeohydro.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def ssebopeta_bycoords(
144144
f_list = helpers.get_ssebopeta_urls(dates)
145145
session = RetrySession()
146146

147-
with patch("socket.has_ipv6", False):
147+
with patch("socket.has_ipv6", False), RetrySession() as session:
148148

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

218218
gtiff2xarray = tlz.partial(geoutils.gtiff2xarray, geometry=geometry, geo_crs=geo_crs)
219-
session = RetrySession()
220-
with patch("socket.has_ipv6", False):
219+
with patch("socket.has_ipv6", False), RetrySession() as session:
221220

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

0 commit comments

Comments
 (0)