API Clients Documentation
This documentation provides an overview of the various API clients available in the rs_client
package. Each client is designed to interact with specific services and provide a convenient way to access their functionalities.
RsClient
RsClient class implementation.
Attributes:
Name | Type | Description |
---|---|---|
rs_server_href |
str
|
RS-Server URL. In local mode, pass None. |
rs_server_api_key |
str
|
API key for RS-Server authentication. If not set, we try to read it from the RSPY_APIKEY environment variable. |
owner_id |
str
|
ID of the owner of the STAC catalog collections (no special characters allowoed). By default, this is the user login from the keycloak account, associated to the API key. Or, in local mode, this is the local system username. Else, your API Key must give you the rights to read/write on this catalog owner. This owner ID is also used in the RS-Client logging. |
logger |
Logger
|
Logging instance. |
local_mode |
bool
|
Local mode or hybrid/cluster mode. |
apikey_headers |
dict
|
API key in a dict, ready-to-use in HTTP request headers. |
Source code in docs/rs-client-libraries/rs_client/rs_client.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
|
apikey_config: dict
property
Return the config from the keycloak account, associated to the api key.
apikey_iam_roles: list[str]
property
Return the IAM (Identity and Access Management) roles from the keycloak account, associated to the api key.
apikey_user_login: str
property
Return the user login from the keycloak account, associated to the api key.
href_search: str
property
Implemented by AuxipClient and CadipClient.
href_staging: str
property
Implemented by AuxipClient and CadipClient.
href_status: str
property
Implemented by AuxipClient and CadipClient.
__init__(rs_server_href, rs_server_api_key=None, owner_id=None, logger=None)
RsClient class constructor.
Source code in docs/rs-client-libraries/rs_client/rs_client.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
apikey_security()
Check the api key validity. Cache an infinite (sys.maxsize) number of results for 120 seconds.
Returns:
Type | Description |
---|---|
tuple[list[str], dict, str]
|
Tuple of (IAM roles, config, user login) information from the keycloak account, associated to the api key. |
Source code in docs/rs-client-libraries/rs_client/rs_client.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
|
get_auxip_client()
Return an instance of the child class AuxipClient, with the same attributes as this "self" instance.
Source code in docs/rs-client-libraries/rs_client/rs_client.py
176 177 178 179 180 181 182 183 184 |
|
get_cadip_client(station)
Return an instance of the child class CadipClient, with the same attributes as this "self" instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
station |
ECadipStation
|
Cadip station |
required |
Source code in docs/rs-client-libraries/rs_client/rs_client.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
|
get_stac_client(*args, **kwargs)
Return an instance of the child class StacClient, with the same attributes as this "self" instance.
Source code in docs/rs-client-libraries/rs_client/rs_client.py
202 203 204 205 206 207 208 209 210 |
|
search_stations(start_date, stop_date, limit=None, sortby=None, timeout=TIMEOUT)
Retrieve a list of files from the specified endpoint.
This function queries the specified endpoint to retrieve a list of files available in the station (CADIP, ADGS, LTA ...) that were collected by the satellite within the provided time range, starting from 'start_date' up to 'stop_date' (inclusive).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start_date |
datetime
|
The start date of the time range. |
required |
stop_date |
datetime
|
The stop date of the time range. |
required |
timeout |
int
|
The timeout duration for the HTTP request. |
TIMEOUT
|
limit |
int
|
The maximum number of results to return. Defaults to None. |
None
|
sortby |
str
|
The attribute to sort the results by. Defaults to None. |
None
|
Returns:
Name | Type | Description |
---|---|---|
files |
list
|
The list of files available at the station within the specified time range. |
Raises:
Type | Description |
---|---|
RuntimeError
|
if the endpoint can't be reached |
Notes
- This function queries the specified endpoint with a time range to retrieve information about available files.
- It constructs a payload with the start and stop dates in ISO 8601 format and sends a GET request to the endpoint.
- The response is expected to be a STAC Compatible formatted JSONResponse, containing information about available files.
- The function converts a STAC FeatureCollection to a Python list.
Source code in docs/rs-client-libraries/rs_client/rs_client.py
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
|
staging(filename, s3_path='', tmp_download_path='', timeout=TIMEOUT)
Stage a file for download.
This method stages a file for download by sending a request to the staging endpoint with optional parameters for S3 path and temporary download path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename |
str
|
The name of the file to be staged for download. |
required |
timeout |
int
|
The timeout duration for the HTTP request. |
TIMEOUT
|
s3_path |
str
|
The S3 path where the file will be stored after download. Defaults to an empty string. |
''
|
tmp_download_path |
str
|
The temporary download path for the file. Defaults to an empty string. |
''
|
Raises:
Type | Description |
---|---|
RuntimeError
|
If an error occurs while staging the file. |
Source code in docs/rs-client-libraries/rs_client/rs_client.py
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
|
staging_status(filename, timeout=TIMEOUT)
Check the status of a file download from the specified rs-server endpoint.
This function sends a GET request to the rs-server endpoint with the filename as a query parameter to retrieve the status of the file download. If the response is successful and contains a 'status' key in the JSON response, the function returns the corresponding download status enum value. If the response is not successful or does not contain the 'status' key, the function returns a FAILED status.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename |
str
|
The name of the file for which to check the status. |
required |
timeout |
int
|
The timeout duration for the HTTP request. |
TIMEOUT
|
Returns:
Name | Type | Description |
---|---|---|
EDownloadStatus |
EDownloadStatus
|
The download status enum value based on the response from the endpoint. |
Source code in docs/rs-client-libraries/rs_client/rs_client.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
|
This client is used for interacting with the RS service. It provides methods for performing common operations such as querying and managing data.
AuxipClient
Bases: RsClient
AuxipClient class implementation.
Attributes: see :py:class:RsClient
Source code in docs/rs-client-libraries/rs_client/auxip_client.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
href_adgs: str
property
Return the RS-Server ADGS URL hostname. This URL can be overwritten using the RSPY_HOST_ADGS env variable (used e.g. for local mode). Either it should just be the RS-Server URL.
href_search: str
property
Return the RS-Server hostname and path where the ADGS search endpoint is deployed.
href_staging: str
property
Return the RS-Server hostname and path where the ADGS staging endpoint is deployed.
href_status: str
property
Return the RS-Server hostname and path where the ADGS status endpoint is deployed.
station_name: str
property
Return "AUXIP".
The AuxipClient is tailored for accessing the AUXIP service. It includes functionalities for handling auxiliary data and metadata.
CadipClient
Bases: RsClient
CadipClient class implementation.
see :py:class:`RsClient`
Name | Type | Description |
---|---|---|
station |
ECadipStation
|
Cadip station |
Source code in docs/rs-client-libraries/rs_client/cadip_client.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
|
href_cadip: str
property
Return the RS-Server CADIP URL hostname. This URL can be overwritten using the RSPY_HOST_CADIP env variable (used e.g. for local mode). Either it should just be the RS-Server URL.
href_search: str
property
Return the RS-Server hostname and path where the CADIP search endpoint is deployed.
href_session: str
property
Return the RS-Server hostname and path where the CADIP search session endpoint is deployed.
href_staging: str
property
Return the RS-Server hostname and path where the CADIP staging endpoint is deployed.
href_status: str
property
Return the RS-Server hostname and path where the CADIP status endpoint is deployed.
station_name: str
property
Return the station name.
__init__(rs_server_href, rs_server_api_key, owner_id, station, logger=None)
CadipClient class constructor.
Source code in docs/rs-client-libraries/rs_client/cadip_client.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
search_sessions(session_ids=None, start_date=None, stop_date=None, platforms=None, timeout=TIMEOUT)
Endpoint to retrieve list of sessions from any CADIP station.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
timeout |
int
|
The timeout duration for the HTTP request. |
TIMEOUT
|
session_ids |
list[str]
|
Session identifiers (eg: ["S1A_20170501121534062343"] or ["S1A_20170501121534062343, S1A_20240328185208053186"]) |
None
|
start_date |
datetime
|
Start date of the time interval |
None
|
stop_date |
datetime
|
Stop date of the time interval |
None
|
platforms |
list[PlatformEnum]
|
platform list |
None
|
Source code in docs/rs-client-libraries/rs_client/cadip_client.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
|
CadipClient is designed to interface with the CADIP service. Use this client to perform tasks related to CADIP data processing and retrieval.
StacClient
Bases: RsClient
, Client
StacClient inherits from both rs_client.RsClient and pystac_client.Client. The goal of this class is to allow an user to use RS-Server services more easily than calling REST endpoints directly.
Source code in docs/rs-client-libraries/rs_client/stac_client.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 |
|
href_catalog: str
property
Return the RS-Server catalog URL hostname. This URL can be overwritten using the RSPY_HOST_CATALOG env variable (used e.g. for local mode). Either it should just be the RS-Server URL.
__init__(id, description, title=None, stac_extensions=None, extra_fields=None, href=None, catalog_type=CatalogType.ABSOLUTE_PUBLISHED, strategy=None, *, modifier=None, **kwargs)
Constructor. Called only by pystac. As an user: don't use this directly, call the open(...) class method instead or RsClient.get_stac_client(...).
Source code in docs/rs-client-libraries/rs_client/stac_client.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
add_collection(collection, add_public_license=True, owner_id=None, timeout=TIMEOUT)
Update the collection links, then post the collection into the catalog.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collection |
Collection
|
STAC collection |
required |
add_public_license |
bool
|
If True, add a public domain license field and link. |
True
|
owner_id |
str
|
Collection owner ID. If missing, we use self.owner_id. |
None
|
timeout |
int
|
The timeout duration for the HTTP request. |
TIMEOUT
|
Returns:
Name | Type | Description |
---|---|---|
JSONResponse |
json
|
The response of the request. |
Source code in docs/rs-client-libraries/rs_client/stac_client.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
|
add_item(collection_id, item, owner_id=None, timeout=TIMEOUT)
Update the item links, then post the item into the catalog.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collection_id |
str
|
The collection id. |
required |
item |
Item
|
STAC item to update and post |
required |
owner_id |
str
|
Collection owner ID. If missing, we use self.owner_id. |
None
|
timeout |
int
|
The timeout duration for the HTTP request. |
TIMEOUT
|
Returns:
Name | Type | Description |
---|---|---|
JSONResponse |
Response
|
The response of the request. |
Source code in docs/rs-client-libraries/rs_client/stac_client.py
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
|
full_collection_id(owner_id, collection_id)
Return the full collection name as:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
owner_id |
str
|
Collection owner ID. If missing, we use self.owner_id. |
required |
collection_id |
str
|
Collection name |
required |
Source code in docs/rs-client-libraries/rs_client/stac_client.py
147 148 149 150 151 152 153 154 155 |
|
get_collection(collection_id, owner_id=None)
cached
Get the requested collection as
Source code in docs/rs-client-libraries/rs_client/stac_client.py
161 162 163 164 165 |
|
open(rs_server_href, rs_server_api_key, owner_id, logger=None, headers=None, parameters=None, ignore_conformance=None, modifier=None, request_modifier=None, stac_io=None, timeout=TIMEOUT)
classmethod
Create a new StacClient instance.
Source code in docs/rs-client-libraries/rs_client/stac_client.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
remove_collection(collection_id, owner_id=None, timeout=TIMEOUT)
Remove/delete a collection from the catalog.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collection_id |
str
|
The collection id. |
required |
owner_id |
str
|
Collection owner ID. If missing, we use self.owner_id. |
None
|
timeout |
int
|
The timeout duration for the HTTP request. |
TIMEOUT
|
Returns:
Name | Type | Description |
---|---|---|
JSONResponse |
Response
|
The response of the request. |
Source code in docs/rs-client-libraries/rs_client/stac_client.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
|
remove_item(collection_id, item_id, owner_id=None, timeout=TIMEOUT)
Remove/delete an item from a collection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collection_id |
str
|
The collection id. |
required |
item_id |
str
|
The item id. |
required |
owner_id |
str
|
Collection owner ID. If missing, we use self.owner_id. |
None
|
timeout |
int
|
The timeout duration for the HTTP request. |
TIMEOUT
|
Returns:
Name | Type | Description |
---|---|---|
JSONResponse |
Response
|
The response of the request. |
Source code in docs/rs-client-libraries/rs_client/stac_client.py
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 |
|
This client allows you to interact with the STAC service, making it easy to search, retrieve, and manage spatio-temporal asset catalog data.
For detailed usage instructions and examples for each client, please refer to the respective sections.