sentinelhub.download.sentinelhub_client

Module implementing a rate-limited multithreaded download client for downloading from Sentinel Hub service

class sentinelhub.download.sentinelhub_client.SentinelHubDownloadClient(*, session=None, default_retry_time=30, **kwargs)[source]

Bases: DownloadClient

Download client specifically configured for download from Sentinel Hub service

Parameters:
  • session (SentinelHubSession | None) – If a session object is provided here then this client instance will always use only the provided session. Otherwise, it will either use a cached session or create a new session and cache it.

  • default_retry_time (float) – The default waiting time (in seconds) when retrying after getting a TOO_MANY_REQUESTS response without appropriate retry headers.

  • kwargs (Any) – Optional parameters from DownloadClient

download(*args, **kwargs)[source]

The main download method

Parameters:
  • args (Any) – Passed to DownloadClient.download

  • kwargs (Any) – Passed to DownloadClient.download

Return type:

Any

get_session()[source]

Provides the session object used by the client

Returns:

A Sentinel Hub session object

Return type:

SentinelHubSession

static cache_session(session, universal=False)[source]

Cache a Sentinel Hub session for to be reused by all instances of SentinelHubDownloadClient and its child classes within the same Python runtime environment.

Parameters:
  • session (SentinelHubSession) – A session object to be cached.

  • universal (bool) – By default a session is cached for a specific OAuth user ID and Sentinel Hub deployment. But if this flag is set to True it will cache session for any OAuth user ID and deployment. The intended purpose of this parameter is that when a session is sent to a remote processing instance, which doesn’t have configured Sentinel Hub OAuth credentials, then the session can still be used even without credentials.

Return type:

None

static clear_cache()[source]

Clears cached sessions.

Return type:

None