Skip to content

Commit bc035cc

Browse files
pjonssonsoxofaan
authored andcommitted
download_url: set check_error=False on HEAD request
Running HEAD on a pre-signed S3 URI gives a 403 response because the URI is signed for GET, so accept a failure for the HEAD request and let the download deal with the issue. Fixes #939
1 parent f4ab16c commit bc035cc

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
- Convert setup.py to pyproject.toml ([#920](https://github.com/Open-EO/openeo-python-client/issues/920))
1515
- Make `_DerivedFrom._from_url` more resilient against unresolvable/unparsable `derived_from` links ([#928](https://github.com/Open-EO/openeo-python-client/issues/928), eu-cdse/openeo-cdse-infra#1338)
16+
- `download_url()`: favor explicit HEAD status check over unhelpful auto-check ([#939](https://github.com/Open-EO/openeo-python-client/issues/939))
1617

1718
### Removed
1819

‎openeo/rest/_connection.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ def download_url(
305305
chunk_size: int = DEFAULT_DOWNLOAD_CHUNK_SIZE,
306306
range_size: int = DEFAULT_DOWNLOAD_RANGE_SIZE,
307307
) -> None:
308-
head = self.head(url, stream=True)
308+
head = self.head(url, stream=True, check_error=False)
309309
if head.ok and head.headers.get("Accept-Ranges") == "bytes" and "Content-Length" in head.headers:
310310
file_size = int(head.headers["Content-Length"])
311311
self._download_ranged(

0 commit comments

Comments
 (0)