S3¶
cdse.s3.S3Client ¶
S3Client(
access_key: str | None = None,
secret_key: str | None = None,
*,
endpoint_url: str = DEFAULT_S3_ENDPOINT_URL,
region: str = "default",
bucket: str = DEFAULT_S3_BUCKET,
client: Any | None = None,
)
Download products and files from the CDSE S3 archive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
access_key
|
str | None
|
S3 access key from the keys manager portal. |
None
|
secret_key
|
str | None
|
S3 secret key from the keys manager portal. |
None
|
endpoint_url
|
str
|
S3 endpoint, defaulting to the public one. |
DEFAULT_S3_ENDPOINT_URL
|
region
|
str
|
S3 region name, |
'default'
|
bucket
|
str
|
Bucket name, |
DEFAULT_S3_BUCKET
|
client
|
Any | None
|
A preconfigured boto3 S3 client, mainly for testing. When given, the credentials are not required and boto3 is not imported here. |
None
|
object_key ¶
object_key(path: str) -> str
Normalise an S3 path to a bucket relative key.
Accepts an s3://eodata/... URI, an OData S3Path such as
/eodata/Sentinel-2/..., or an already relative key.
download_file ¶
download_file(key: str, destination: str | Path) -> Path
Download a single object to destination.
download ¶
download(path: str, destination: str | Path) -> Path
Download a product or file from its S3 path.
A product is stored as a prefix containing many objects, so every object
under the prefix is downloaded into destination while preserving the
directory structure below the product folder. Returns the local path
that was written to.
from_settings
classmethod
¶
from_settings(settings: Any) -> S3Client
Build a client from a :class:cdse.config.Settings instance.