phidown.downloader

Attributes

TOKEN_URL

CLIENT_ID

logger

Functions

get_token(→ str)

Acquire an access token from Copernicus Data Space Ecosystem.

download_burst_on_demand(→ None)

Download and save a Sentinel-1 burst product from CDSE.

main(→ None)

Main function for command-line usage of s5cmd_utils.

Module Contents

phidown.downloader.TOKEN_URL = 'https://identity.dataspace.copernicus.eu/auth/realms/cdse/protocol/openid-connect/token'[source]
phidown.downloader.CLIENT_ID = 'cdse-public'[source]
phidown.downloader.logger[source]
phidown.downloader.get_token(username: str, password: str) str[source]

Acquire an access token from Copernicus Data Space Ecosystem.

This function authenticates with the CDSE identity service using username and password credentials to obtain a Keycloak access token for API access.

Parameters:
  • username – CDSE account username.

  • password – CDSE account password.

Returns:

The access token string to be used for authenticated API requests.

Return type:

str

Raises:
  • AssertionError – If username or password is empty.

  • requests.exceptions.HTTPError – If the authentication request fails.

Example

>>> token = get_token('myuser@example.com', 'mypassword')
Acquired keycloak token!
phidown.downloader.download_burst_on_demand(burst_id: str, token: str, output_dir: pathlib.Path) None[source]

Download and save a Sentinel-1 burst product from CDSE.

This function requests on-demand processing of a single Sentinel-1 burst and downloads the resulting product as a ZIP file. The burst is identified by its UUID from the CDSE catalogue.

Parameters:
  • burst_id – UUID of the burst to download from the CDSE catalogue.

  • token – Keycloak access token obtained from get_token().

  • output_dir – Directory path where the burst ZIP file will be saved.

Raises:

Example

>>> from pathlib import Path
>>> token = get_token('user@example.com', 'password')
>>> download_burst('12345678-1234-1234-1234-123456789abc', token, Path('./output'))
Processing burst...
Processing has been successful!
Saving output product...
Output product has been saved to: ./output/burst_12345678.zip
phidown.downloader.main() None[source]

Main function for command-line usage of s5cmd_utils.

This function provides a simple CLI interface for downloading Sentinel-1 data from the Copernicus Data Space Ecosystem.