zscaler-sdk-python 0.1.8__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/PKG-INFO +4 -4
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/pyproject.toml +7 -7
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/__init__.py +1 -1
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/constants.py +3 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/__init__.py +21 -7
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/app_segments.py +34 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/certificates.py +3 -1
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/inspection.py +386 -400
- zscaler_sdk_python-0.3.0/zscaler/zpa/isolation.py +681 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/lss.py +39 -49
- zscaler_sdk_python-0.3.0/zscaler/zpa/policiesv2.py +1667 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/posture_profiles.py +32 -1
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/scim_groups.py +1 -38
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/server_groups.py +0 -1
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/trusted_networks.py +15 -35
- zscaler_sdk_python-0.1.8/zscaler/zpa/isolation_profile.py +0 -85
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/LICENSE.md +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/README.md +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/cache/__init__.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/cache/cache.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/cache/no_op_cache.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/cache/zscaler_cache.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/errors/__init__.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/errors/error.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/errors/http_error.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/errors/zscaler_api_error.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/exceptions/__init__.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/exceptions/exceptions.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/logger.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/ratelimiter/__init__.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/ratelimiter/ratelimiter.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/user_agent.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/utils.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/__init__.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/activate.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/admin_and_role_management.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/apptotal.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/audit_logs.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/authentication_settings.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/client.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/cloud_apps.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/device_management.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/dlp.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/errors.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/firewall.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/forwarding_control.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/isolation_profile.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/labels.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/locations.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/sandbox.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/security.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/ssl_inspection.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/traffic.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/url_categories.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/url_filtering.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/users.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/web_dlp.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/workload_groups.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zia/zpa_gateway.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/README.md +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/app_segments_inspection.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/app_segments_pra.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/client.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/cloud_connector_groups.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/connectors.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/emergency_access.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/errors.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/idp.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/machine_groups.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/policies.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/privileged_remote_access.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/provisioning.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/saml_attributes.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/scim_attributes.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/segment_groups.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/servers.py +0 -0
- {zscaler_sdk_python-0.1.8 → zscaler_sdk_python-0.3.0}/zscaler/zpa/service_edges.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: zscaler-sdk-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Official Python SDK for the Zscaler Products (Beta)
|
|
5
5
|
Home-page: https://github.com/zscaler/zscaler-sdk-python
|
|
6
6
|
License: MIT
|
|
@@ -23,9 +23,10 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
23
23
|
Provides-Extra: dev
|
|
24
24
|
Requires-Dist: aenum ; extra == "dev"
|
|
25
25
|
Requires-Dist: arrow
|
|
26
|
-
Requires-Dist: black
|
|
26
|
+
Requires-Dist: black ; extra == "dev"
|
|
27
27
|
Requires-Dist: certifi
|
|
28
28
|
Requires-Dist: charset-normalizer
|
|
29
|
+
Requires-Dist: cryptography (>=3.4,<43.0)
|
|
29
30
|
Requires-Dist: flake8
|
|
30
31
|
Requires-Dist: flatdict
|
|
31
32
|
Requires-Dist: idna
|
|
@@ -35,11 +36,10 @@ Requires-Dist: python-box (>=7.1.1,<8.0.0)
|
|
|
35
36
|
Requires-Dist: python-dateutil
|
|
36
37
|
Requires-Dist: pytz
|
|
37
38
|
Requires-Dist: pyyaml
|
|
38
|
-
Requires-Dist: requests
|
|
39
|
+
Requires-Dist: requests (>=2.32.0)
|
|
39
40
|
Requires-Dist: responses
|
|
40
41
|
Requires-Dist: restfly
|
|
41
42
|
Requires-Dist: six
|
|
42
|
-
Requires-Dist: urllib3
|
|
43
43
|
Requires-Dist: xmltodict
|
|
44
44
|
Requires-Dist: yarl
|
|
45
45
|
Project-URL: Bug Tracker, https://github.com/zscaler/zscaler-sdk-python/issues
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "zscaler-sdk-python"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.3.0"
|
|
4
4
|
description = "Official Python SDK for the Zscaler Products (Beta)"
|
|
5
5
|
authors = ["Zscaler, Inc. <devrel@zscaler.com>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -35,11 +35,10 @@ charset-normalizer = "*"
|
|
|
35
35
|
idna = "*"
|
|
36
36
|
python-box = "^7.1.1"
|
|
37
37
|
python-dateutil = "*"
|
|
38
|
-
requests = "
|
|
38
|
+
requests = ">=2.32.0"
|
|
39
39
|
responses = "*"
|
|
40
40
|
restfly = "*"
|
|
41
41
|
six = "*"
|
|
42
|
-
urllib3 = "*"
|
|
43
42
|
flatdict = "*"
|
|
44
43
|
pyyaml = "*"
|
|
45
44
|
xmltodict = "*"
|
|
@@ -49,12 +48,13 @@ aenum = "*"
|
|
|
49
48
|
pydash = "*"
|
|
50
49
|
flake8 = "*"
|
|
51
50
|
pytz = "*"
|
|
52
|
-
black = "
|
|
51
|
+
black = "*"
|
|
52
|
+
cryptography = ">=3.4,<43.0"
|
|
53
53
|
|
|
54
54
|
[tool.poetry.dev-dependencies]
|
|
55
|
-
black = "
|
|
56
|
-
pytest = "
|
|
57
|
-
pytest-asyncio = "
|
|
55
|
+
black = "24.3.0"
|
|
56
|
+
pytest = "^8.2.1"
|
|
57
|
+
pytest-asyncio = ">=0.23.7"
|
|
58
58
|
pytest-mock = "*"
|
|
59
59
|
pytest-recording = "*"
|
|
60
60
|
pytest-cov = "*"
|
|
@@ -9,8 +9,11 @@ ZPA_BASE_URLS = {
|
|
|
9
9
|
"PREVIEW": "https://config.zpapreview.net",
|
|
10
10
|
"QA": "https://config.qa.zpath.net",
|
|
11
11
|
"QA2": "https://pdx2-zpa-config.qa2.zpath.net",
|
|
12
|
+
"DEV": "https://public-api.dev.zpath.net",
|
|
12
13
|
}
|
|
13
14
|
|
|
15
|
+
DEV_AUTH_URL = "https://authn1.dev.zpath.net/authn/v1/oauth/token"
|
|
16
|
+
|
|
14
17
|
RETRYABLE_STATUS_CODES = {429, 500, 502, 503, 504}
|
|
15
18
|
MAX_RETRIES = 5
|
|
16
19
|
BACKOFF_FACTOR = 1
|
|
@@ -11,7 +11,7 @@ from box import BoxList
|
|
|
11
11
|
from zscaler import __version__
|
|
12
12
|
from zscaler.cache.no_op_cache import NoOpCache
|
|
13
13
|
from zscaler.cache.zscaler_cache import ZscalerCache
|
|
14
|
-
from zscaler.constants import ZPA_BASE_URLS
|
|
14
|
+
from zscaler.constants import ZPA_BASE_URLS, DEV_AUTH_URL
|
|
15
15
|
from zscaler.errors.http_error import HTTPError, ZscalerAPIError
|
|
16
16
|
from zscaler.exceptions.exceptions import HTTPException, ZscalerAPIException
|
|
17
17
|
from zscaler.logger import setup_logging
|
|
@@ -36,10 +36,11 @@ from zscaler.zpa.connectors import AppConnectorControllerAPI
|
|
|
36
36
|
from zscaler.zpa.emergency_access import EmergencyAccessAPI
|
|
37
37
|
from zscaler.zpa.idp import IDPControllerAPI
|
|
38
38
|
from zscaler.zpa.inspection import InspectionControllerAPI
|
|
39
|
-
from zscaler.zpa.
|
|
39
|
+
from zscaler.zpa.isolation import IsolationAPI
|
|
40
40
|
from zscaler.zpa.lss import LSSConfigControllerAPI
|
|
41
41
|
from zscaler.zpa.machine_groups import MachineGroupsAPI
|
|
42
42
|
from zscaler.zpa.policies import PolicySetsAPI
|
|
43
|
+
from zscaler.zpa.policiesv2 import PolicySetsV2API
|
|
43
44
|
from zscaler.zpa.posture_profiles import PostureProfilesAPI
|
|
44
45
|
from zscaler.zpa.privileged_remote_access import PrivilegedRemoteAccessAPI
|
|
45
46
|
from zscaler.zpa.provisioning import ProvisioningKeyAPI
|
|
@@ -151,7 +152,7 @@ class ZPAClientHelper(ZPAClient):
|
|
|
151
152
|
@retry_with_backoff(retries=5)
|
|
152
153
|
def login(self):
|
|
153
154
|
"""Log in to the ZPA API and set the access token for subsequent requests."""
|
|
154
|
-
|
|
155
|
+
params = {"client_id": self.client_id, "client_secret": self.client_secret}
|
|
155
156
|
headers = {
|
|
156
157
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
157
158
|
"Accept": "application/json",
|
|
@@ -159,6 +160,9 @@ class ZPAClientHelper(ZPAClient):
|
|
|
159
160
|
}
|
|
160
161
|
try:
|
|
161
162
|
url = f"{self.baseurl}/signin"
|
|
163
|
+
if self.cloud == "DEV":
|
|
164
|
+
url = DEV_AUTH_URL + "?grant_type=CLIENT_CREDENTIALS"
|
|
165
|
+
data = urllib.parse.urlencode(params)
|
|
162
166
|
resp = requests.post(url, data=data, headers=headers, timeout=self.timeout)
|
|
163
167
|
# Avoid logging all data from the response, focus on the status and a summary instead
|
|
164
168
|
logger.info("Login attempt with status: %d", resp.status_code)
|
|
@@ -187,6 +191,8 @@ class ZPAClientHelper(ZPAClient):
|
|
|
187
191
|
api = self.v2_lss_url
|
|
188
192
|
elif api_version == "userconfig_v1":
|
|
189
193
|
api = self.user_config_url
|
|
194
|
+
elif api_version == "cbiconfig_v1":
|
|
195
|
+
api = self.cbi_url
|
|
190
196
|
|
|
191
197
|
url = f"{api}/{path.lstrip('/')}"
|
|
192
198
|
start_time = time.time()
|
|
@@ -456,7 +462,7 @@ class ZPAClientHelper(ZPAClient):
|
|
|
456
462
|
params["page"] = page
|
|
457
463
|
|
|
458
464
|
finally:
|
|
459
|
-
time.sleep(
|
|
465
|
+
time.sleep(2) # Ensure a delay between requests regardless of outcome
|
|
460
466
|
|
|
461
467
|
if not ret_data:
|
|
462
468
|
error_msg = ERROR_MESSAGES["EMPTY_RESULTS"]
|
|
@@ -498,12 +504,12 @@ class ZPAClientHelper(ZPAClient):
|
|
|
498
504
|
return CertificatesAPI(self)
|
|
499
505
|
|
|
500
506
|
@property
|
|
501
|
-
def
|
|
507
|
+
def isolation(self):
|
|
502
508
|
"""
|
|
503
|
-
The interface object for the :ref:`ZPA Isolation
|
|
509
|
+
The interface object for the :ref:`ZPA Isolation <zpa-isolation>`.
|
|
504
510
|
|
|
505
511
|
"""
|
|
506
|
-
return
|
|
512
|
+
return IsolationAPI(self)
|
|
507
513
|
|
|
508
514
|
@property
|
|
509
515
|
def cloud_connector_groups(self):
|
|
@@ -569,6 +575,14 @@ class ZPAClientHelper(ZPAClient):
|
|
|
569
575
|
"""
|
|
570
576
|
return PolicySetsAPI(self)
|
|
571
577
|
|
|
578
|
+
@property
|
|
579
|
+
def policiesv2(self):
|
|
580
|
+
"""
|
|
581
|
+
The interface object for the :ref:`ZPA Policy Sets V2 interface <zpa-policiesv2>`.
|
|
582
|
+
|
|
583
|
+
"""
|
|
584
|
+
return PolicySetsV2API(self)
|
|
585
|
+
|
|
572
586
|
@property
|
|
573
587
|
def posture_profiles(self):
|
|
574
588
|
"""
|
|
@@ -91,6 +91,40 @@ class ApplicationSegmentAPI:
|
|
|
91
91
|
return app
|
|
92
92
|
return None
|
|
93
93
|
|
|
94
|
+
def get_segments_by_type(self, application_type: str, expand_all: bool = False, **kwargs) -> Box:
|
|
95
|
+
"""
|
|
96
|
+
Retrieve all configured application segments of a specified type, optionally expanding all related data.
|
|
97
|
+
|
|
98
|
+
Args:
|
|
99
|
+
application_type (str): Type of application segment to retrieve. Must be one of "BROWSER_ACCESS", "INSPECT", "SECURE_REMOTE_ACCESS".
|
|
100
|
+
expand_all (bool, optional): Whether to expand all related data. Defaults to False.
|
|
101
|
+
|
|
102
|
+
Keyword Args:
|
|
103
|
+
max_items (int, optional): The maximum number of items to request before stopping iteration.
|
|
104
|
+
max_pages (int, optional): The maximum number of pages to request before stopping iteration.
|
|
105
|
+
pagesize (int, optional): Specifies the page size. The default size is 20, but the maximum size is 500.
|
|
106
|
+
page (int, optional): Specifies the page number to begin fetching from.
|
|
107
|
+
search (str, optional): The search string used to match against features and fields.
|
|
108
|
+
|
|
109
|
+
Returns:
|
|
110
|
+
BoxList: List of application segments.
|
|
111
|
+
|
|
112
|
+
Examples:
|
|
113
|
+
>>> app_type = 'BROWSER_ACCESS'
|
|
114
|
+
>>> expand_all = True
|
|
115
|
+
>>> search = "ba_server01"
|
|
116
|
+
>>> app_segments = zpa.app_segments.get_segments_by_type(app_type, expand_all, search=search)
|
|
117
|
+
"""
|
|
118
|
+
params = {"applicationType": application_type, "expandAll": "true" if expand_all else "false"}
|
|
119
|
+
# Include additional search parameters if specified
|
|
120
|
+
if "search" in kwargs:
|
|
121
|
+
params["search"] = kwargs["search"]
|
|
122
|
+
|
|
123
|
+
result, error = self.rest.get_paginated_data(path="/application/getAppsByType", params=params, **kwargs)
|
|
124
|
+
if error:
|
|
125
|
+
return BoxList([]) # Return an empty BoxList on failure due to the error
|
|
126
|
+
return result
|
|
127
|
+
|
|
94
128
|
def delete_segment(self, segment_id: str, force_delete: bool = False) -> int:
|
|
95
129
|
"""
|
|
96
130
|
Delete an application segment.
|
|
@@ -171,7 +171,9 @@ class CertificatesAPI:
|
|
|
171
171
|
>>> ba_certificate = zpa.certificates.get_certificate('99999')
|
|
172
172
|
|
|
173
173
|
"""
|
|
174
|
-
|
|
174
|
+
response = self.rest.delete("/certificate/%s" % (certificate_id))
|
|
175
|
+
return response.status_code
|
|
176
|
+
# return self.rest.get(f"certificate/{certificate_id}")
|
|
175
177
|
|
|
176
178
|
def get_enrolment(self, certificate_id: str) -> Box:
|
|
177
179
|
"""
|