unistra_s3#
- unistra_s3() None [source]#
Initialize a temporary S3 environment as a context manager, with Unistra endpoint
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):
AWS profile “unistra”
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:
default_endpoint (str) – Default Endpoint to look for
Example
>>> from sertit.unistra import unistra_s3 >>> from sertit import AnyPath >>> def file_exists(path: str): >>> with unistra_s3(): >>> pth = AnyPath(path) >>> print(pth.exists()) >>> file_exists("s3://sertit-geodatastore/GLOBAL/COPDEM_30m/COPDEM_30m.vrt") True