Client Abstract

class jelastic.api.abstract.ClientAbstract(session: Session, token: str, debug: bool = False, ruk: str | None = None)[source]

Abstract class representing a Jelastic API client.

Parameters:
  • session – HTTPX session

  • token – Jelastic API token

  • debug – enable debug mode

Variables:
  • _endpoint1 – first part of the endpoint

  • _endpoint2 – second part of the endpoint

  • _required_permission – required permission for the endpoint

Returns:

Jelastic API client

__init__(session: Session, token: str, debug: bool = False, ruk: str | None = None) None[source]

Initialize the client with the given session and token.

Parameters:
  • session – HTTPX session

  • token – Jelastic API token

  • debug – enable debug mode

  • ruk – Jelastic RUK (random unique key)

_endpoint(path: str, params: dict[str, Any] | None = None, delimiter: str | None = None, datetime_format: str | None = None) str[source]

Returns the endpoint for the request.

Parameters:
  • path – endpoint path

  • params – endpoint params

Returns:

endpoint for the request (e.g. /endpoint1/endpoint2/rest/path?appid=cluster&session=token)

_handle_response(response: dict[str, Any]) dict[str, Any][source]

Handle the response from the API.

Parameters:

response – response from the API

_log_debug(method: Literal['get', 'post'], path: str, params: dict[str, Any] | None = None) None[source]

Prints debug information about the request.

Parameters:
  • method – HTTP method

  • path – endpoint path

  • params – endpoint params

_serialize_params(params: dict[str, Any], delimiter: str | None = None, datetime_format: str | None = None) str[source]

Serialize params for endpoint URL

Parameters:

params – endpoint params

Returns:

serialized params for endpoint URL (e.g. appid=cluster&session=token)