Skip to content

AsyncOutlineClient

An asynchronous client for interacting with an Outline VPN server's API.

Provides asynchronous access to server management, metrics, and access key functionalities.

Attributes:

Name Type Description
server AsyncServer

Manages server-level settings and configurations.

metrics AsyncMetrics

Monitors and retrieves server metrics.

access_keys AsyncAccessKeys

Manages access keys.

Parameters:

Name Type Description Default
management_url str

The management URL used to communicate with the Outline server API.

'https://myoutline.com/SecretPath'
ssl_verify bool

Flag to enable or disable SSL certificate verification. Default is False.

False
Source code in outline_vpn_api_client/async_client.py
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
class AsyncOutlineClient:
    """
    An asynchronous client for interacting with an Outline VPN server's API.

    Provides asynchronous access to server management, metrics, and access key functionalities.

    Attributes:
        server (AsyncServer): Manages server-level settings and configurations.
        metrics (AsyncMetrics): Monitors and retrieves server metrics.
        access_keys (AsyncAccessKeys): Manages access keys.

    Args:
        management_url (str): The management URL used to communicate with the Outline server API.
        ssl_verify (bool, optional): Flag to enable or disable SSL certificate verification. Default is False.
    """

    def __init__(self, management_url: str = "https://myoutline.com/SecretPath", ssl_verify: bool = False):
        self.server = AsyncServer(management_url, ssl_verify)
        self.metrics = AsyncMetrics(management_url, ssl_verify)
        self.access_keys = AsyncAccessKeys(management_url, ssl_verify)

    async def get_information(self) -> models.Info:
        """
        Retrieves detailed information about the Outline server, including its
        configuration, metrics status, and access keys.

        Returns:
            models.Info: Server info, metrics status, and list of access keys.

        Raises:
            ResponseNotOkException: If the server response indicates an error (status code >= 300).
        """
        return models.Info.model_validate({
            "server": await self.server.get_information(),
            "metrics": {"enabled": await self.metrics.check_enabled()},
            "access_keys": await self.access_keys.get_all(),
        })

    def __str__(self):
        return json.dumps({"info": "AsyncOutlineClient for Outline VPN server API"}, ensure_ascii=False)

get_information() async

Retrieves detailed information about the Outline server, including its configuration, metrics status, and access keys.

Returns:

Type Description
Info

models.Info: Server info, metrics status, and list of access keys.

Raises:

Type Description
ResponseNotOkException

If the server response indicates an error (status code >= 300).

Source code in outline_vpn_api_client/async_client.py
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
async def get_information(self) -> models.Info:
    """
    Retrieves detailed information about the Outline server, including its
    configuration, metrics status, and access keys.

    Returns:
        models.Info: Server info, metrics status, and list of access keys.

    Raises:
        ResponseNotOkException: If the server response indicates an error (status code >= 300).
    """
    return models.Info.model_validate({
        "server": await self.server.get_information(),
        "metrics": {"enabled": await self.metrics.check_enabled()},
        "access_keys": await self.access_keys.get_all(),
    })