phidown.downloader
Attributes
Functions
|
Acquire an access token from Copernicus Data Space Ecosystem. |
|
Download and save a Sentinel-1 burst product from CDSE. |
|
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.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:
- 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:
AssertionError – If burst_id or token is empty.
RuntimeError – If burst processing fails or returns non-200 status.
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