Skip to content

Overview

Bases: SkahaClient

Overview of the Skaha Server.

Parameters:

Name Type Description Default
SkahaClient Object

Skaha Client.

required
Source code in skaha/overview.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
class Overview(SkahaClient):
    """Overview of the Skaha Server.

    Args:
        SkahaClient (Object): Skaha Client.
    """

    @model_validator(mode="after")
    def _set_server(self) -> Self:
        """Sets the server path after validation."""
        suffix = "availability"
        self.server = f"{self.server}/{suffix}"  # type: ignore
        log.debug(f"Server set to {self.server}")
        return self

    def availability(self) -> bool:
        """Check if the server backend is available.

        Returns:
            bool: True if the server is available, False otherwise.
        """
        response: Response = self.session.get(url=self.server)  # type: ignore # noqa
        response.raise_for_status()
        # Parse the XML string
        root = ET.fromstring(response.text)
        available = root.find(
            ".//{http://www.ivoa.net/xml/VOSIAvailability/v1.0}available"
        ).text  # type: ignore
        log.info("Server available: %s", available)
        if available == "true":
            return True
        return False

availability()

Check if the server backend is available.

Returns:

Name Type Description
bool bool

True if the server is available, False otherwise.

Source code in skaha/overview.py
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
def availability(self) -> bool:
    """Check if the server backend is available.

    Returns:
        bool: True if the server is available, False otherwise.
    """
    response: Response = self.session.get(url=self.server)  # type: ignore # noqa
    response.raise_for_status()
    # Parse the XML string
    root = ET.fromstring(response.text)
    available = root.find(
        ".//{http://www.ivoa.net/xml/VOSIAvailability/v1.0}available"
    ).text  # type: ignore
    log.info("Server available: %s", available)
    if available == "true":
        return True
    return False