Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch/fix aws endpoint url #665

Merged
merged 2 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion rio_tiler/io/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 2 additions & 5 deletions rio_tiler/io/stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]:
Expand All @@ -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":
Expand Down
Loading