sentinelhub.api.base

Module implementing some utility functions not suitable for other utility modules

class sentinelhub.api.base.SentinelHubService(config=None)[source]

Bases: object

A base class for classes interacting with different Sentinel Hub APIs

Parameters:

config (SHConfig | 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.

class sentinelhub.api.base.SentinelHubFeatureIterator(*args, exception_message=None, **kwargs)[source]

Bases: FeatureIterator[Dict[str, Any]]

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

Parameters:
  • args (Any) – Arguments passed to FeatureIterator

  • exception_message (str | None) – A message to be raised if no features are found

  • kwargs (Any) – Keyword arguments passed to FeatureIterator

class sentinelhub.api.base.BaseCollection(name, s3_bucket, additional_data, collection_id=None, user_id=None, created=None, no_data=None, other_data=<factory>)[source]

Bases: object

Dataclass to hold data about a collection

Parameters:
  • name (str) –

  • s3_bucket (str) –

  • additional_data (_AdditionalData | None) –

  • collection_id (str | None) –

  • user_id (str | None) –

  • created (datetime | None) –

  • no_data (int | float | None) –

  • other_data (CatchAllVar | None) –

name: str
s3_bucket: str
additional_data: _AdditionalData | None
collection_id: str | None = None
user_id: str | None = None
created: datetime | None = None
no_data: int | float | None = None
other_data: CatchAllVar | None
to_data_collection()[source]

Returns a DataCollection enum for this collection

Return type:

DataCollection

dataclass_json_config = {'letter_case': <function camelcase>, 'undefined': Undefined.INCLUDE}
classmethod from_dict(kvs, *, infer_missing=False)
Parameters:

kvs (dict | list | str | int | float | bool | None) –

Return type:

A

classmethod from_json(s, *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw)
Parameters:

s (str | bytes | bytearray) –

Return type:

A

classmethod schema(*, infer_missing=False, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)
Parameters:
  • infer_missing (bool) –

  • many (bool) –

  • partial (bool) –

Return type:

SchemaF[A]

to_dict(encode_json=False)
Return type:

Dict[str, dict | list | str | int | float | bool | None]

to_json(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, indent=None, separators=None, default=None, sort_keys=False, **kw)
Parameters:
  • skipkeys (bool) –

  • ensure_ascii (bool) –

  • check_circular (bool) –

  • allow_nan (bool) –

  • indent (int | str | None) –

  • separators (Tuple[str, str] | None) –

  • default (Callable | None) –

  • sort_keys (bool) –

Return type:

str