sentinelhub.api.utils

Module implementing some common utility functions

sentinelhub.api.utils.enum_config(enum_class)[source]

Given an Enum class it provide an object for serialization/deserialization

Parameters:

enum_class (Type[Enum]) –

Return type:

Dict[str, dict]

sentinelhub.api.utils.remove_undefined(payload)[source]

Takes a dictionary and removes keys without value

Parameters:

payload (dict) –

Return type:

dict

class sentinelhub.api.utils.S3Specification(*args, **kwargs)[source]

Bases: dict

Specification of a S3 path.

url: str
accessKey: str
secretAccessKey: str
region: typing_extensions.NotRequired[str]
class sentinelhub.api.utils.AccessSpecification(*args, **kwargs)[source]

Bases: dict

Specification of a S3 input or output.

s3: S3Specification
sentinelhub.api.utils.s3_specification(url, access_key, secret_access_key, region=None)[source]

A helper method to build a dictionary used for specifying S3 paths

Parameters:
  • url (str) – A URL pointing to an S3 bucket or an object in an S3 bucket.

  • access_key (str) – AWS access key that allows programmatic access to the S3 bucket specified in the url field.

  • secret_access_key (str) – AWS secret access key which must correspond to the AWS access key.

  • region (str | None) – The region where the S3 bucket is located. If omitted, the region of the Sentinel Hub deployment that the request is submitted to is assumed.

Returns:

A dictionary of S3 specifications used by the Batch Statistical API

Return type:

AccessSpecification