Exceptions
This file contains the exception classes for the PyClasher
package.
MISSING = Missing()
module-attribute
MISSING
object
This Missing-instance is used as a reference in many parts of the package.
instance of the Missing
class
AccessDenied
Bases: ApiException
Access denied, either because of missing/incorrect credentials or used API token does not grant access to the requested resource.
Source code in pyclasher/exceptions.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
|
__init__(client_error=None)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client_error |
ClientError
|
optional |
None
|
Source code in pyclasher/exceptions.py
116 117 118 119 120 121 122 123 |
|
ApiException
Bases: PyClasherException
Exception class that is subclassed by every API exception
Attributes:
Name | Type | Description |
---|---|---|
api_code |
int
|
API status code of the request |
client_error |
ClientError
|
optional |
Source code in pyclasher/exceptions.py
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 |
|
__init__(api_code, client_error=None)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_code |
int
|
API status code of the request |
required |
client_error |
ClientError
|
optional |
None
|
Source code in pyclasher/exceptions.py
73 74 75 76 77 78 79 80 81 82 83 |
|
ApiExceptions
Collection of the ApiExceptions
Attributes:
Name | Type | Description |
---|---|---|
BadRequest |
BadRequest
|
|
AccessDenied |
AccessDenied
|
|
NotFound |
NotFound
|
|
Throttled |
Throttled
|
|
UnknownApiException |
UnknownApiException
|
|
Maintenance |
Maintenance
|
|
Source code in pyclasher/exceptions.py
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 |
|
from_api_code(api_code, client_error=None)
classmethod
Class method to create a subclass of ApiException
using the API
code and the optional client error information that is provided by the
request itself.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_code |
int
|
API status code of the request |
required |
client_error |
ClientError
|
optional |
None
|
Returns:
Type | Description |
---|---|
ApiException
|
returns a subclass of |
Raises:
Type | Description |
---|---|
PyClasherException
|
|
Source code in pyclasher/exceptions.py
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 |
|
BadRequest
Bases: ApiException
Client provided incorrect parameters for the request.
Source code in pyclasher/exceptions.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
__init__(client_error=None)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client_error |
ClientError
|
optional |
None
|
Source code in pyclasher/exceptions.py
97 98 99 100 101 102 103 104 |
|
ClientAlreadyInitialised
Bases: PyClasherException
Exception that is raised if a new client was created but there is another client that has at least one equal token.
Source code in pyclasher/exceptions.py
353 354 355 356 357 358 359 360 361 |
|
ClientIsNotRunning
Bases: PyClasherException
Exception that is raised if the client is not running but an action that requires the client to run was done.
Source code in pyclasher/exceptions.py
343 344 345 346 347 348 349 350 |
|
ClientIsRunning
Bases: PyClasherException
Exception that is raised if the client is started multiple times without stopping the client between those calls.
Source code in pyclasher/exceptions.py
332 333 334 335 336 337 338 339 340 |
|
ClientRunningOverwrite
Bases: PyClasherException
Exception that is raised if the client is running but a client parameter was tried to edit but requires a client that is not running.
Source code in pyclasher/exceptions.py
400 401 402 403 404 405 406 407 |
|
InvalidClientId
Bases: PyClasherException
Exception that is raised if a client ID is not valid. It can already been
taken, or it can be equal to an ID that is in the range of 0 to
global_client_id
.
Source code in pyclasher/exceptions.py
443 444 445 446 447 448 449 |
|
InvalidLoginData
Bases: PyClasherException
Exception that is raised if the provided login data using
Client.from_login(..., ...)
is not valid.
Source code in pyclasher/exceptions.py
286 287 288 289 290 291 292 293 |
|
InvalidSeasonFormat
Bases: PyClasherException
Exception that is raised if the season format is not valid.
Source code in pyclasher/exceptions.py
410 411 412 413 414 415 416 417 418 |
|
InvalidTimeFormat
Bases: PyClasherException
Exception that is raised if the provided time format is not recognized by the API.
Attributes:
Name | Type | Description |
---|---|---|
value |
str
|
value string of the invalid time |
time_format |
str
|
format of a valid time string |
Source code in pyclasher/exceptions.py
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 |
|
__init__(value, time_format)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
str
|
value string of the invalid time |
required |
time_format |
str
|
format of a valid time string |
required |
Source code in pyclasher/exceptions.py
384 385 386 387 388 389 390 391 392 393 |
|
InvalidType
Bases: PyClasherException
Exception that is raised if a type is incorrect (similar to TypeError
)
Attributes:
Name | Type | Description |
---|---|---|
element |
Any
|
the element whose type is not correct |
types |
type, tuple[type, ...
|
correct type or types |
Source code in pyclasher/exceptions.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
|
__init__(element, allowed_types)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
element |
Any
|
the element whose type is not correct |
required |
allowed_types |
type, tuple[type, ...
|
correct type or types |
required |
Source code in pyclasher/exceptions.py
305 306 307 308 309 310 311 312 313 314 315 |
|
LoginNotDone
Bases: PyClasherException
Exception that is raised of raised if the login is not done but tokens
were tried to retrieve. (similar to RequestNotDone
)
Source code in pyclasher/exceptions.py
322 323 324 325 326 327 328 329 |
|
Maintenance
Bases: ApiException
Service is temporarily unavailable because of maintenance.
Source code in pyclasher/exceptions.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
|
__init__(client_error=None)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client_error |
ClientError
|
optional |
None
|
Source code in pyclasher/exceptions.py
192 193 194 195 196 197 198 199 |
|
Missing
Class of the MISSING
object
Notes
This class always returns itself. One time received in a response there
is no way back to an object different from MISSING
.
Attributes:
Name | Type | Description |
---|---|---|
return_string |
str
|
the string that is returned using
|
Source code in pyclasher/exceptions.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
NoClient
Bases: PyClasherException
Exception that is raised if a request was started but there is no client that can execute the request.
Source code in pyclasher/exceptions.py
364 365 366 367 368 369 370 371 |
|
NoneToken
Bases: PyClasherException
Exception that is raised if a client is started without any tokens.
Source code in pyclasher/exceptions.py
275 276 277 278 279 280 281 282 283 |
|
NotFound
Bases: ApiException
Resource was not found.
Source code in pyclasher/exceptions.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|
__init__(client_error=None)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client_error |
ClientError
|
optional |
None
|
Source code in pyclasher/exceptions.py
136 137 138 139 140 141 142 143 |
|
PyClasherException
Bases: Exception
Exception class that is subclassed by every exception to the pyclasher
package
Source code in pyclasher/exceptions.py
55 56 57 58 59 60 |
|
RequestNotDone
Bases: PyClasherException
Exception that is raised if a request attribute, property, ... was accessed but could not be loaded because the request was not done.
Source code in pyclasher/exceptions.py
265 266 267 268 269 270 271 272 |
|
RequestTimeout
Bases: PyClasherException
Exception that is raised if a request takes longer than allowed.
Attributes:
Name | Type | Description |
---|---|---|
allowed_time |
float
|
maximal time a request is allowed to take |
Source code in pyclasher/exceptions.py
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 |
|
__init__(allowed_time)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
allowed_time |
float
|
maximal time a request is allowed to take |
required |
Source code in pyclasher/exceptions.py
429 430 431 432 433 434 435 436 |
|
Throttled
Bases: ApiException
Request was throttled, because amount of requests was above the threshold defined for the used API token.
Source code in pyclasher/exceptions.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
|
__init__(client_error=None)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client_error |
ClientError
|
optional |
None
|
Source code in pyclasher/exceptions.py
155 156 157 158 159 160 161 162 |
|
UnknownApiException
Bases: ApiException
Unknown error happened when handling the request.
Source code in pyclasher/exceptions.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
|
__init__(client_error=None)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client_error |
ClientError
|
optional |
None
|
Source code in pyclasher/exceptions.py
174 175 176 177 178 179 180 181 |
|