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

support for setting the S3 endpoint url #394

Merged
merged 3 commits into from
Jun 1, 2021
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
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## Unreleased

* add support for setting the S3 endpoint url via the `AWS_S3_ENDPOINT` environment variables in `aws_get_object` function using boto3 (https://github.com/cogeotiff/rio-tiler/pull/394)
## 2.1.0 (2021-05-17)

* add auto-rescaling in `ImageData.render` method to avoid error when datatype is not supported by the output driver (https://github.com/cogeotiff/rio-tiler/pull/391)
Expand Down
4 changes: 3 additions & 1 deletion rio_tiler/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""rio_tiler.utils: utility functions."""

import os
from io import BytesIO
from typing import Any, Dict, Generator, Optional, Sequence, Tuple, Union

Expand Down Expand Up @@ -36,7 +37,8 @@ def aws_get_object(
"""AWS s3 get object content."""
if not client:
session = boto3_session()
client = session.client("s3")
endpoint_url = os.environ.get("AWS_S3_ENDPOINT", None)
client = session.client("s3", endpoint_url=endpoint_url)

params = {"Bucket": bucket, "Key": key}
if request_pays:
Expand Down