pa_api.panorama

 1from panos import panorama
 2
 3from .utils import clean_url_host, get_credentials_from_env
 4
 5
 6class Panorama(panorama.Panorama):
 7    """
 8    Wrapper class for the Panorama class from pan-os-python library:
 9    https://pan-os-python.readthedocs.io/en/latest/readme.html#features
10
11    Added features are:
12    - hostname can be provided with and without the scheme
13        - https://mydomain.com
14        - mydomain.com
15        - https://mydomain.com:443
16      Are all valid
17    """
18
19    def __init__(
20        self,
21        host=None,
22        api_username=None,
23        api_password=None,
24        api_key=None,
25        port=None,
26        *args,
27        **kwargs,
28    ):
29        env_host, env_apikey = get_credentials_from_env()
30        host = host or env_host
31        api_key = api_key or env_apikey
32        if not host:
33            raise Exception("Missing Host")
34        if not api_key:
35            raise Exception("Missing API Key")
36        host, _, _ = clean_url_host(host)
37        return super().__init__(
38            host, api_username, api_password, api_key, port, *args, **kwargs
39        )
class Panorama(panos.panorama.Panorama):
 7class Panorama(panorama.Panorama):
 8    """
 9    Wrapper class for the Panorama class from pan-os-python library:
10    https://pan-os-python.readthedocs.io/en/latest/readme.html#features
11
12    Added features are:
13    - hostname can be provided with and without the scheme
14        - https://mydomain.com
15        - mydomain.com
16        - https://mydomain.com:443
17      Are all valid
18    """
19
20    def __init__(
21        self,
22        host=None,
23        api_username=None,
24        api_password=None,
25        api_key=None,
26        port=None,
27        *args,
28        **kwargs,
29    ):
30        env_host, env_apikey = get_credentials_from_env()
31        host = host or env_host
32        api_key = api_key or env_apikey
33        if not host:
34            raise Exception("Missing Host")
35        if not api_key:
36            raise Exception("Missing API Key")
37        host, _, _ = clean_url_host(host)
38        return super().__init__(
39            host, api_username, api_password, api_key, port, *args, **kwargs
40        )

Wrapper class for the Panorama class from pan-os-python library: https://pan-os-python.readthedocs.io/en/latest/readme.html#features

Added features are:

Panorama( host=None, api_username=None, api_password=None, api_key=None, port=None, *args, **kwargs)
20    def __init__(
21        self,
22        host=None,
23        api_username=None,
24        api_password=None,
25        api_key=None,
26        port=None,
27        *args,
28        **kwargs,
29    ):
30        env_host, env_apikey = get_credentials_from_env()
31        host = host or env_host
32        api_key = api_key or env_apikey
33        if not host:
34            raise Exception("Missing Host")
35        if not api_key:
36            raise Exception("Missing API Key")
37        host, _, _ = clean_url_host(host)
38        return super().__init__(
39            host, api_username, api_password, api_key, port, *args, **kwargs
40        )

Initialize PanDevice