aihwkit.cloud.client.session module

Session handler for the AIHW Composer API.

class aihwkit.cloud.client.session.ApiSession(api_url, api_token, verify=True)[source]

Bases: Session

Session handler for requests to the AIHW Composer API.

Custom Session for interfacing with the AIHW Composer API, using:

  • authorization based on jwt token.

  • custom user agent for the requests.

Additionally, this class stores information about the API URL and base token.

Parameters:
  • api_url (str) –

  • api_token (str) –

  • verify (bool) –

request(method, url, *args, **kwargs)[source]

Construct a Request, prepares it and sends it.

Parameters:
  • method (str) – method for the new Request object.

  • url (str | bytes) – URL for the new Request object.

  • args (Any) – additional arguments for the original requests method.

  • kwargs (Any) – additional arguments for the original requests method.

Returns:

A new Response object.

Raises:

ApiResponseError – if the response did not have a valid status code.

Return type:

Any

update_jwt_token(jwt_token)[source]

Set the jwt token for the session.

Parameters:

jwt_token (str) –

Return type:

None

class aihwkit.cloud.client.session.ObjectStorageSession[source]

Bases: Session

Session handler for requests to object storage.

request(method, url, *args, **kwargs)[source]

Construct a Request, prepares it and sends it.

Parameters:
  • method (str) – method for the new Request object.

  • url (str | bytes) – URL for the new Request object.

  • args (Any) – additional arguments for the original requests method.

  • kwargs (Any) – additional arguments for the original requests method.

Returns:

A new Response object.

Raises:

ResponseError – if the response did not have a valid status code.

Return type:

Any