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.AccessSpecification[source]

Bases: TypedDict

Specification of a S3 input or output.

s3: Dict[str, Any]
sentinelhub.api.utils.s3_specification(url, access_key=None, secret_access_key=None, iam_role_arn=None, region=None)[source]

A helper method to build a dictionary used for specifying S3 paths. Consult the access documentation for more information.

In general either use iam_role_arn or access_key plus secret_access_key.

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

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

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

  • iam_role_arn (str | None) – IAM role ARN, which allows programmatic access to the S3 bucket specified in the url field using the recommended assume IAM role flow.

  • 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