parityos.api_interface — ParityOS 2.1.1 documentation

# parityos.api_interface

class parityos.api_interface.ClientBase(username: str | None = None, host: str = 'api.parityqc.com', url_prefix: str = 'v1', http_retries: int = 3, http_timeout: int = 10, http_backoff_factor: float = 0.02, intents: int = 3)

  Base class that sets up HTTP parameters (authentication, API endpoints, and so on). It should not be used directly unless you are debugging HTTP requests, use parityos.CompilerClient instead.

  __init__(username: str | None = None, host: str = 'api.parityqc.com', url_prefix: str = 'v1', http_retries: int = 3, http_timeout: int = 10, http_backoff_factor: float = 0.02, intents: int = 3)
    Parameters:

      - username (str) – ParityOS id of the user.

      - host (str) – ParityAPI host name.

      - url_prefix (str) – Prefix to REST API paths, used mostly for versioning.

      - http_retries (int) – Number of http retries.

      - http_timeout (int) – Maximum time in seconds to wait for a http response.

      - http_backoff_factor (int) – Http exponential backoff factor.

      - intents (int) – Maximum number of intents with different passwords.

class parityos.api_interface.CompilerRun(id, submission_id, status, submitted_at, started_at=None, finished_at=None, failed_at=None, failure_reason=None)

  Encapsulates a compiler run; has attributes which describe relevant times at which they were submitted, started, and eventually finished or failed (in which case, a reason for failure is also given).

  __init__(id, submission_id, status, submitted_at, started_at=None, finished_at=None, failed_at=None, failure_reason=None)
    Parameters:

      - id – id of the compiler run in ParityOS cloud database

      - submission_id – id of the submission which triggered compile run

      - status – status of the submission; see CompilerRunStatus enum

      - submitted_at – time at which run was queued for execution

      - started_at – time at which run started being executed

      - finished_at – time at which run was completed

      - failed_at – time at which run failed

      - failure_reason – reason for which run failed

  classmethod from_json(data: Mapping[str, str | int | float | bool | None | Dict[str, Any] | List[Any]]) → CompilerRun

    Creates a CompilerRun object from a JSON-like data dictionary. :return: a CompilerRun object

class parityos.api_interface.CompilerRunStatus(value)

  Enum for compiler run status.

exception parityos.api_interface.ParityOSAuthError(*args, **kwargs)

  Exception for failed logins to the ParityAPI server.

exception parityos.api_interface.ParityOSRequestError(*args, **kwargs)

  Exception for failed logins to the ParityAPI server.