Skip to content

Commit

Permalink
Added timeout to request fething on resources
Browse files Browse the repository at this point in the history
  • Loading branch information
GriffinBabe committed Apr 15, 2024
1 parent 276d0ba commit eaf3d8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/test_openeo_gfmap/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
def load_dataset_url(url: str) -> NamedTemporaryFile:
"""Download a NetCDF file from the internet and return a Xarray Dataset."""
with NamedTemporaryFile(suffix=".nc", delete=True) as tmpfile:
response = requests.get(url)
response = requests.get(url, timeout=60)
response.raise_for_status()
tmpfile.write(response.content)

Expand All @@ -21,7 +21,7 @@ def load_dataset_url(url: str) -> NamedTemporaryFile:
def load_dataarray_url(url: str) -> NamedTemporaryFile:
"""Download a NetCDF file from the internet and return a Xarray Dataset."""
with NamedTemporaryFile(suffix=".nc", delete=True) as tmpfile:
response = requests.get(url)
response = requests.get(url, timeout=60)
response.raise_for_status()
tmpfile.write(response.content)

Expand Down

0 comments on commit eaf3d8a

Please sign in to comment.