skybrush_log_analyzer.api_client
skybrush_log_analyzer.api_client.APIClient
Client of the Skybrush Log Analyzer API.
Source code in skybrush_log_analyzer/api_client.py
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 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 | |
config
property
The config of the client.
analyze(path, *, test_names=None)
Uploads the given log file, runs the analysis on it, and returns the stored analysis.
Runs only the given tests when test names are given, after validating them against the full test listing. The returned analysis holds the results of the default tests, merged with those of the extra tests when some of the given tests have no default result.
Raises:
| Type | Description |
|---|---|
UnknownTests
|
Some of the test names are not in any test group. |
Source code in skybrush_log_analyzer/api_client.py
get_analysis(path, *, extras=False)
Returns the stored analysis of the given log file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
The log file. |
required |
extras
|
bool
|
Whether to return the results of the extra, verbose tests instead of the default ones. |
False
|
Raises:
| Type | Description |
|---|---|
NotFound
|
The log file has not been analyzed yet. |
Source code in skybrush_log_analyzer/api_client.py
get_analysis_view_intent(path)
Returns the web view intent for the analysis of the given log file.
Raises:
| Type | Description |
|---|---|
NotFound
|
The log file has not been analyzed yet. |
Source code in skybrush_log_analyzer/api_client.py
get_suggestions(*, released=None)
Returns the previously submitted feedback.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
released
|
bool | None
|
Whether to list only released ( |
None
|
Source code in skybrush_log_analyzer/api_client.py
get_web_login_url(*, intent=None)
Acquires a web login URL for the user, optionally with a web view intent.
Source code in skybrush_log_analyzer/api_client.py
login(config_dir, api_key, *, api_url=None)
classmethod
Validates the given API key and stores it in the config file of the given config directory.
The account and API URLs are taken from that config file. A given api_url
is used instead of the stored one, and stored along with the API key.
On failure, the config file is left unchanged and the token stored in the config directory is cleared.
Returns:
| Type | Description |
|---|---|
Self
|
A client using the validated API key. |
Raises:
| Type | Description |
|---|---|
Unauthenticated
|
The API rejected the token acquired with the API key. |
InvalidAPIKey
|
The account rejected the API key. |
AccountUnreachable
|
The account could not be reached or returned an unexpected response. |
APIUnreachable
|
The API could not be reached. |
ConfigError
|
The token or the API key could not be stored. |
ApplicationError
|
The API could not validate the token. |
Source code in skybrush_log_analyzer/api_client.py
logout()
Invalidates the client, so any further request raises Unauthenticated,
then removes the API key and the token from the config.
Raises:
| Type | Description |
|---|---|
ConfigError
|
The API key or the token could not be removed. |
Source code in skybrush_log_analyzer/api_client.py
suggest(*, category, title, content)
Submits feedback about the analysis service and returns the submission result.
Source code in skybrush_log_analyzer/api_client.py
tests(group='default')
Returns the descriptions of the available tests in the given test group.
Source code in skybrush_log_analyzer/api_client.py
validate_test_names(names, group='default')
Checks that all the given test names belong to the given test group.
Raises:
| Type | Description |
|---|---|
UnknownTests
|
Some of the test names are not in the test group. |
Source code in skybrush_log_analyzer/api_client.py
verify_credentials()
Acquires a fresh API token and checks that the API accepts it.
Raises:
| Type | Description |
|---|---|
Unauthenticated
|
No API key is configured, or the API rejected the token. |
InvalidAPIKey
|
The account rejected the API key. |
AccountUnreachable
|
The account could not be reached or returned an unexpected response. |
APIUnreachable
|
The API could not be reached. |
ConfigError
|
The token could not be stored. |
ApplicationError
|
The API could not validate the token. |
Source code in skybrush_log_analyzer/api_client.py
skybrush_log_analyzer.api_client.calculate_file_hash(path)
Returns the SHA-256 hex digest of the content of the given file.