diff --git a/CHANGES.md b/CHANGES.md index e5afc31c..8cd9bdfb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,8 @@ +# 6.2.9 (2023-12-21) + +* fix AWS endpoint credential for STAC `fetch` function, using same defaults as GDAL vsis3 configuration + # 6.2.8 (2023-12-11) * apply `discrete` colormap when the provided colormap does not have 256 values diff --git a/rio_tiler/io/base.py b/rio_tiler/io/base.py index 5e98bfea..4123e995 100644 --- a/rio_tiler/io/base.py +++ b/rio_tiler/io/base.py @@ -4,6 +4,7 @@ import contextlib import re import warnings +from functools import cached_property from typing import Any, Dict, List, Optional, Sequence, Tuple, Type, Union import attr @@ -43,7 +44,7 @@ class SpatialMixin: geographic_crs: CRS = attr.ib(init=False, default=WGS84_CRS) - @property + @cached_property def geographic_bounds(self) -> BBox: """Return dataset bounds in geographic_crs.""" if self.crs == self.geographic_crs: diff --git a/rio_tiler/io/stac.py b/rio_tiler/io/stac.py index b30339b4..5a6d8f72 100644 --- a/rio_tiler/io/stac.py +++ b/rio_tiler/io/stac.py @@ -73,7 +73,7 @@ def aws_get_object( # AWS_S3_ENDPOINT and AWS_HTTPS are GDAL config options of vsis3 driver # https://gdal.org/user/virtual_file_systems.html#vsis3-aws-s3-files - endpoint_url = os.environ.get("AWS_S3_ENDPOINT", None) + endpoint_url = os.environ.get("AWS_S3_ENDPOINT", "s3.amazonaws.com") if endpoint_url: use_https = os.environ.get("AWS_HTTPS", "YES") if use_https.upper() in ["YES", "TRUE", "ON"]: @@ -82,10 +82,7 @@ def aws_get_object( else: endpoint_url = "http://" + endpoint_url - client = session.client( - "s3", - endpoint_url=endpoint_url or "s3.amazonaws.com", - ) + client = session.client("s3", endpoint_url=endpoint_url) params = {"Bucket": bucket, "Key": key} if request_pays or os.environ.get("AWS_REQUEST_PAYER", "").lower() == "requester":