s3_env

Contents

s3_env#

s3_env(*args, **kwargs)[source]#

Create Unistra’s S3 compatible storage environment.

This function searches for S3 configuration in many places. It does apply configuration variables precedence, and you might have a use for it. Here is the order of precedence from least to greatest (the last listed configuration variables override all other variables):

  1. AWS profile

  2. AWS environment variable

Profile unistra is first read from X:/SI/Secrets/config and X:/SI/Secrets/credentials. If this file does not exist, it fallbacks to local file $USER/.aws/config and $USER/.aws/credentials.

You can use ready-to-use environements provided by the Sertit or asks for s3 credentials.

Parameters:

function (Callable) – Function to decorate

Returns:

decorated function

Return type:

Callable

Example

>>> from sertit.unistra import s3_env
>>> from sertit import AnyPath
>>> @s3_env
>>> def file_exists(path: str):
>>>     pth = AnyPath(path)
>>>     print(pth.exists())
>>> file_exists("s3://sertit-geodatastore/GLOBAL/COPDEM_30m/COPDEM_30m.vrt")
True