Definition at line 21 of file client.py.
◆ __init__()
def coordinator.client.Client.__init__ |
( |
|
self, |
|
|
str |
base_url, |
|
|
Optional[str] |
cert_path = None , |
|
|
bool |
insecure = False |
|
) |
| |
Definition at line 23 of file client.py.
26 cert_path: Optional[str] =
None,
27 insecure: bool =
False):
28 assert not cert_path
or exists(cert_path)
29 self.base_url = base_url
30 self.verify: Union[bool, str,
None] =
False if insecure
else cert_path
◆ get_challenge()
None coordinator.client.Client.get_challenge |
( |
|
self, |
|
|
str |
challenge_file |
|
) |
| |
GET /challenge request, downloading to file
Definition at line 62 of file client.py.
62 def get_challenge(self, challenge_file: str) ->
None:
64 GET /challenge request, downloading to file
71 def _get_challenge() -> Response:
73 join(self.base_url,
"challenge"),
78 with _get_challenge()
as resp:
79 if resp.status_code == 503:
80 print(SERVER_BUSY_503_CLIENT_MSG)
84 resp.raise_for_status()
85 with open(challenge_file,
"wb")
as out_f:
86 for chunk
in resp.iter_content(chunk_size=CHUNK_SIZE):
◆ get_contributors()
GET /contributors
Get the status of the server.
Definition at line 32 of file client.py.
32 def get_contributors(self) -> ContributorList:
35 Get the status of the server.
38 resp = get(join(self.base_url,
"contributors"), verify=self.verify)
39 if resp.status_code == 503:
40 print(SERVER_BUSY_503_CLIENT_MSG)
44 resp.raise_for_status()
45 return ContributorList.from_json(resp.content.decode())
◆ get_state()
ServerState coordinator.client.Client.get_state |
( |
|
self | ) |
|
GET /state
Get the status of the server.
Definition at line 47 of file client.py.
47 def get_state(self) -> ServerState:
50 Get the status of the server.
53 resp = get(join(self.base_url,
"state"), verify=self.verify)
54 if resp.status_code == 503:
55 print(SERVER_BUSY_503_CLIENT_MSG)
59 resp.raise_for_status()
60 return ServerState.from_json(resp.content.decode())
◆ push_contribution()
None coordinator.client.Client.push_contribution |
( |
|
self, |
|
|
str |
response_file, |
|
|
bytes |
response_digest, |
|
|
VerificationKey |
verification_key, |
|
|
Signature |
signature |
|
) |
| |
POST /contribute, uploading from file with all authentication headers
Definition at line 90 of file client.py.
90 def push_contribution(
93 response_digest: bytes,
94 verification_key: VerificationKey,
95 signature: Signature) ->
None:
97 POST /contribute, uploading from file with all authentication headers
104 with open(response_file,
"rb")
as upload_f:
106 join(self.base_url,
"contribute"),
107 files={
'response': upload_f},
110 resp.raise_for_status()
◆ base_url
coordinator.client.Client.base_url |
The documentation for this class was generated from the following file:
- /home/runner/work/zeth/zeth/mpc/coordinator/client.py