temp_s3

Contents

temp_s3#

temp_s3(endpoint=None, default_endpoint: str = None, requester_pays: bool = False, no_sign_request: bool = False, **kwargs) None[source]#

Initialize a temporary S3 environment as a context manager

Parameters:
  • default_endpoint (str) – Default Endpoint to look for

  • requester_pays (bool) – True if the endpoint says ‘requester pays’

  • no_sign_request (bool) – True if the endpoint is open access

Example

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