rs_common/utils.md
This module is used to share common functions between apis
AuthInfo
dataclass
User authentication information in Keycloak.
Source code in docs/rs-client-libraries/rs_common/utils.py
29 30 31 32 33 34 35 36 37 38 39 40 | |
create_valcover_filter(start_datetime, end_datetime, product_type)
Creates a ValCover filter from the input values to be used in flows
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_datetime
|
datetime | str
|
Start datetime for the time interval used to filter the files |
required |
end_datetime
|
datetime | str
|
End datetime for the time interval used to filter the files |
required |
product_type
|
str
|
Auxiliary file type wanted |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
ValCover filter |
Source code in docs/rs-client-libraries/rs_common/utils.py
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 | |
env_bool(var, default)
Return True if an environemnt variable is set to 1, true or yes (case insensitive). Return False if set to 0, false or no (case insensitive). Return the default value if not set or set to a different value.
Source code in docs/rs-client-libraries/rs_common/utils.py
67 68 69 70 71 72 73 74 75 76 77 78 | |
extract_tar(file_path, extract_to)
Extract a TAR-compatible archive into the target directory.
Source code in docs/rs-client-libraries/rs_common/utils.py
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 | |
extract_zip(zip_path, extract_to)
Extract a ZIP archive into the target directory.
Source code in docs/rs-client-libraries/rs_common/utils.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
get_href_service(rs_server_href, env_var)
Get specific href link.
Source code in docs/rs-client-libraries/rs_common/utils.py
58 59 60 61 62 63 64 | |
get_upload_prefix(asset_href, asset_name)
Return the S3 prefix where extracted content should be uploaded.
Source code in docs/rs-client-libraries/rs_common/utils.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
normalize_extract_dir(extract_dir)
Return the directory that should be used as the upload root.
If the extraction produced a single top-level directory, descend into it to avoid creating an unnecessary extra folder level in S3.
Source code in docs/rs-client-libraries/rs_common/utils.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | |
read_response_error(response)
Read and return an HTTP response error detail.
Source code in docs/rs-client-libraries/rs_common/utils.py
43 44 45 46 47 48 49 50 51 52 53 54 55 | |
recursive_extract(folder)
Extract nested TAR-compatible archives found anywhere under folder.
Source code in docs/rs-client-libraries/rs_common/utils.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | |
strftime_millis(date)
Format datetime with milliseconds precision
Source code in docs/rs-client-libraries/rs_common/utils.py
81 82 83 | |
strip_archive_suffix(name)
Return the asset name without its supported archive suffix.
Source code in docs/rs-client-libraries/rs_common/utils.py
194 195 196 197 198 199 | |