mate.integration.challenge_broker package¶
Wrappers for the CHESS challenge broker’s REST API endpoints.
- exception mate.integration.challenge_broker.BrokerError¶
Bases:
mate_common.error.MateError
Raised whenever an unrecoverable error during challenge broker interaction occurs.
- class mate.integration.challenge_broker.Client(base: Optional[str] = None)¶
Bases:
object
A client for the CHESS challenge broker’s REST API.
MATE APIs that interact with the challenge broker should use
client
.- Parameters
base (Optional[str]) –
- blob_by_id(id_: str) Optional[mate_common.models.challenge_broker.Blob] ¶
Returns a blob by ID, if present.
- Parameters
id_ (str) –
- Return type
Optional[mate_common.models.challenge_broker.Blob]
- blob_data(blob: mate_common.models.challenge_broker.Blob) Optional[BinaryIO] ¶
Return a fileobj containing the contents of the given blob.
- Parameters
- Return type
Optional[BinaryIO]
- blob_data_by_id(id_: str) Optional[BinaryIO] ¶
Return a fileobj containing the contents of the blob referenced by the given ID.
- Parameters
id_ (str) –
- Return type
Optional[BinaryIO]
- blobs() List[mate_common.models.challenge_broker.Blob] ¶
Returns the blobs that are currently available on the broker.
- Return type
- challenge_by_id(id_: str) Optional[mate_common.models.challenge_broker.Challenge] ¶
Returns a challenge by ID, if present.
- Parameters
id_ (str) –
- Return type
- challenge_by_name(name: str) Optional[mate_common.models.challenge_broker.Challenge] ¶
Returns a challenge by name, if present.
Raises
BrokerError
if the underlying request fails.- Parameters
name (str) –
- Return type
- challenges() List[mate_common.models.challenge_broker.Challenge] ¶
Returns the challenges that are currently available on the broker.
Raises
BrokerError
if the request fails.- Return type
- create_blob(filename: pathlib.Path) mate_common.models.challenge_broker.Blob ¶
Create a new blob, populating it with the contents of the given file.
- Parameters
filename (pathlib.Path) –
- Return type
- create_target(challenge: mate_common.models.challenge_broker.Challenge, blob: mate_common.models.challenge_broker.Blob, *, source_assisted: bool = False, description: Optional[str] = None, parent_id: Optional[str] = None) mate_common.models.challenge_broker.RequestedTarget ¶
Create a new target, by way of the “requested targets” API.
- Parameters
challenge (mate_common.models.challenge_broker.Challenge) –
source_assisted (bool) –
description (Optional[str]) –
parent_id (Optional[str]) –
- Return type
- root_blob(*, for_: mate_common.models.challenge_broker.Challenge) Optional[mate_common.models.challenge_broker.Blob] ¶
Returns the blob associated with the root target for a challenge, if present.
- Parameters
- Return type
Optional[mate_common.models.challenge_broker.Blob]
- root_target(*, for_: mate_common.models.challenge_broker.Challenge) Optional[mate_common.models.challenge_broker.Target] ¶
Returns the root target for a challenge, if present.
- Parameters
- Return type
- target_by_id(id_: str) Optional[mate_common.models.challenge_broker.Target] ¶
Returns a target by ID, if present.
- Parameters
id_ (str) –
- Return type
- targets(*, for_: Optional[mate_common.models.challenge_broker.Challenge] = None) List[mate_common.models.challenge_broker.Target] ¶
Returns the targets that are currently available on the broker.
- Parameters
for_ (Optional[mate_common.models.challenge_broker.Challenge]) –
- Return type