Module implementing some utility functions not suitable for other utility modules


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

class sentinelhub.sh_utils.BaseCollection(name: str, s3_bucket: str, other_data: Optional[CatchAllVar], collection_id: Optional[str] = None, user_id: Optional[str] = None, created: Optional[datetime.datetime] = None, no_data: Union[int, float, None] = None)[source]

Bases: object

Dataclass to hold data about a collection


Returns a DataCollection enum for this collection

class sentinelhub.sh_utils.SentinelHubService(config=None, base_url=None)[source]

Bases: object

A base class for classes interacting with different Sentinel Hub APIs

  • config (SHConfig or None) – A configuration object with required parameters sh_client_id, sh_client_secret, and sh_auth_base_url which is used for authentication and sh_base_url which defines the service deployment that will be used.
  • base_url (str or None) – A deprecated parameter. Use config instead.
class sentinelhub.sh_utils.FeatureIterator(client, url, params=None)[source]

Bases: abc.ABC

An implementation of a base feature iteration class

Main functionalities:

  • The iterator will load only as many features as needed at any moment
  • It will keep downloaded features in memory so that iterating over it again will not have to download the same features again.
  • client (DownloadClient) – An instance of a download client object
  • url (str) – An URL where requests will be made
  • params (dict or None) – Parameters to be sent with each request
class sentinelhub.sh_utils.SentinelHubFeatureIterator(*args, exception_message=None, **kwargs)[source]

Bases: sentinelhub.sh_utils.FeatureIterator

Feature iterator for the most common implementation of feature pagination at Sentinel Hub services

  • args – Arguments passed to FeatureIterator
  • exception_message (str) – A message to be raise if no feature are found
  • kwargs – Keyword arguments passed to FeatureIterator

Takes a dictionary and removes keys without value