Skip to content

API client

This page describes APIClient abstract class which is inherited by all client implementations.

APIClient

Bases: ABC

API client abstract class that defines abstract methods that each derived class should define.

Attributes:

Name Type Description
url str

Typhoon Test Hub url

Source code in tth\client\client_base.py
class APIClient(ABC):
    """
    API client abstract class that defines abstract methods that each derived class should define.

    Attributes:
        url (str): Typhoon Test Hub url
    """

    def __init__(self, url):
        """
       Constructs API client object.

       Parameters:
           url (str): Typhoon Test Hub url
       """
        self.url = url

    @abstractmethod
    def test_credentials(self):
        """
        Tests if provided credentials are valid
        """
        pass

    @abstractmethod
    def get_request_headers(self):
        """
        Generates dictionary with request header parameters
        """
        pass

    @property
    def trigger(self):
        """
        An object for interacting with Trigger API.
        """
        return TriggerAPI(client=self)

    @property
    def execution(self):
        """
        An object for interacting with Execution API.
        """
        return ExecutionAPI(client=self)

    @property
    def report(self):
        """
        An object for interacting with Report API.
        """
        return ReportAPI(client=self)

    @property
    def artifact(self):
        """
        An object for interacting with Artifact API.
        """
        return ArtifactAPI(client=self)

artifact property

An object for interacting with Artifact API.

execution property

An object for interacting with Execution API.

report property

An object for interacting with Report API.

trigger property

An object for interacting with Trigger API.

__init__(url)

Constructs API client object.

Parameters:

Name Type Description Default
url str

Typhoon Test Hub url

required
Source code in tth\client\client_base.py
def __init__(self, url):
    """
   Constructs API client object.

   Parameters:
       url (str): Typhoon Test Hub url
   """
    self.url = url

get_request_headers() abstractmethod

Generates dictionary with request header parameters

Source code in tth\client\client_base.py
@abstractmethod
def get_request_headers(self):
    """
    Generates dictionary with request header parameters
    """
    pass

test_credentials() abstractmethod

Tests if provided credentials are valid

Source code in tth\client\client_base.py
@abstractmethod
def test_credentials(self):
    """
    Tests if provided credentials are valid
    """
    pass