Skip to content

Commit

Permalink
support for setting the S3 endpoint url (#394)
Browse files Browse the repository at this point in the history
* AWS_S3_ENDPOINT in aws_get_object

* updated changelog

* linting
  • Loading branch information
emmanuelmathot authored Jun 1, 2021
1 parent 447d2ef commit f197f20
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
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

0 comments on commit f197f20

Please sign in to comment.