zscaler-sdk-python 0.1.1__tar.gz → 0.1.3__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.1/zscaler_sdk_python.egg-info → zscaler_sdk_python-0.1.3}/PKG-INFO +36 -7
- zscaler_sdk_python-0.1.3/pyproject.toml +94 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/__init__.py +10 -1
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/cache/no_op_cache.py +1 -3
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/cache/zscaler_cache.py +1 -3
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/errors/zscaler_api_error.py +1 -4
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/ratelimiter/ratelimiter.py +1 -3
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/user_agent.py +1 -3
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/utils.py +13 -44
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/__init__.py +13 -41
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/admin_and_role_management.py +3 -9
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/audit_logs.py +1 -3
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/authentication_settings.py +2 -6
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/cloud_apps.py +2 -6
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/dlp.py +38 -50
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/firewall.py +18 -58
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/forwarding_control.py +2 -6
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/labels.py +1 -3
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/locations.py +7 -23
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/sandbox.py +21 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/security.py +2 -6
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/ssl_inspection.py +3 -9
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/traffic.py +14 -48
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/url_categories.py +10 -30
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/url_filtering.py +2 -6
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/users.py +3 -11
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/web_dlp.py +2 -6
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/zpa_gateway.py +4 -12
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/__init__.py +13 -41
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/app_segments.py +6 -20
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/app_segments_inspection.py +7 -23
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/app_segments_pra.py +6 -20
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/certificates.py +2 -6
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/connectors.py +9 -27
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/emergency_access.py +4 -12
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/inspection.py +20 -64
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/isolation_profile.py +1 -3
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/lss.py +11 -35
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/policies.py +12 -36
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/posture_profiles.py +1 -3
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/privileged_remote_access.py +19 -59
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/provisioning.py +4 -13
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/saml_attributes.py +2 -6
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/scim_attributes.py +1 -3
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/scim_groups.py +1 -3
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/segment_groups.py +4 -12
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/server_groups.py +3 -9
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/servers.py +2 -6
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/service_edges.py +7 -23
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/trusted_networks.py +1 -3
- zscaler-sdk-python-0.1.1/CHANGELOG.md +0 -20
- zscaler-sdk-python-0.1.1/MANIFEST.in +0 -8
- zscaler-sdk-python-0.1.1/PKG-INFO +0 -333
- zscaler-sdk-python-0.1.1/docsrc/Makefile +0 -24
- zscaler-sdk-python-0.1.1/docsrc/conf.py +0 -223
- zscaler-sdk-python-0.1.1/docsrc/index.rst +0 -136
- zscaler-sdk-python-0.1.1/docsrc/zs/guides/examples.rst +0 -94
- zscaler-sdk-python-0.1.1/docsrc/zs/guides/index.rst +0 -13
- zscaler-sdk-python-0.1.1/docsrc/zs/guides/support.rst +0 -27
- zscaler-sdk-python-0.1.1/docsrc/zs/guides/troubleshooting.rst +0 -9
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/activate.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/admin_and_role_management.rst +0 -13
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/apptotal.rst +0 -13
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/audit_logs.rst +0 -13
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/authentication_settings.rst +0 -13
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/cloud_apps.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/device_management.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/dlp.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/firewall.rst +0 -13
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/forwarding_control.rst +0 -13
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/index.rst +0 -15
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/isolation_profile.rst +0 -13
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/locations.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/rule_labels.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/sandbox.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/security.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/ssl_inspection.rst +0 -13
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/traffic.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/url_categories.rst +0 -23
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/url_filtering.rst +0 -13
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/users.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/web_dlp.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/workload_groups.rst +0 -13
- zscaler-sdk-python-0.1.1/docsrc/zs/zia/zpa_gateway.rst +0 -13
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/app_segments.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/app_segments_inspection.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/app_segments_pra.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/certificates.rst +0 -13
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/cloud_connector_groups.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/connectors.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/emergency_access.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/idp.rst +0 -13
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/index.rst +0 -15
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/inspection.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/isolation_profile.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/lss.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/machine_groups.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/policies.rst +0 -13
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/posture_profiles.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/privileged_remote_access.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/provisioning.rst +0 -13
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/saml_attributes.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/scim_attributes.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/scim_groups.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/segment_groups.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/server_groups.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/servers.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/service_edges.rst +0 -14
- zscaler-sdk-python-0.1.1/docsrc/zs/zpa/trusted_networks.rst +0 -14
- zscaler-sdk-python-0.1.1/requirements.txt +0 -33
- zscaler-sdk-python-0.1.1/setup.cfg +0 -10
- zscaler-sdk-python-0.1.1/setup.py +0 -44
- zscaler-sdk-python-0.1.1/tests/conftest.py +0 -35
- zscaler-sdk-python-0.1.1/tests/integration/zia/conftest.py +0 -65
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_activation.py +0 -51
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_admin_and_role_management.py +0 -73
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_authentication_settings.py +0 -69
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_cloud_firewall_ip_destination_groups.py +0 -106
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_cloud_firewall_ip_source_groups.py +0 -101
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_cloud_firewall_rule.py +0 -144
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_dlp_dictionary.py +0 -106
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_dlp_engines.py +0 -117
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_dlp_icap_server.py +0 -72
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_dlp_idm_profile.py +0 -76
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_dlp_incident_receiver.py +0 -77
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_dlp_web_rule.py +0 -101
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_isolation_profile.py +0 -78
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_location_group.py +0 -120
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_location_management.py +0 -338
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_rule_labels.py +0 -102
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_sandbox.py +0 -162
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_security.py +0 -114
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_traffic_gre_tunnel.py +0 -358
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_traffic_static_ip.py +0 -102
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_traffic_vpn_credential.py +0 -123
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_url_categories.py +0 -262
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_url_filtering_rule.py +0 -124
- zscaler-sdk-python-0.1.1/tests/integration/zia/test_users.py +0 -218
- zscaler-sdk-python-0.1.1/tests/integration/zpa/conftest.py +0 -64
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_access_policy_forwarding_rules.py +0 -106
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_access_policy_rules.py +0 -132
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_access_policy_timeout_rules.py +0 -106
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_app_connector_groups.py +0 -111
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_application_segment.py +0 -167
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_application_servers.py +0 -103
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_ba_certificates.py +0 -81
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_enrolment_certificates.py +0 -67
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_idp.py +0 -78
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_isolation_profile.py +0 -73
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_machine_groups.py +0 -82
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_posture_profiles.py +0 -86
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_pra_approval.py +0 -218
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_pra_credential.py +0 -112
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_pra_portal.py +0 -117
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_provisioning_key_app_connector_group.py +0 -146
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_provisioning_key_service_edge_group.py +0 -147
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_saml_attributes.py +0 -89
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_scim_attributes.py +0 -77
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_scim_groups.py +0 -75
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_segment_groups.py +0 -101
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_server_groups.py +0 -129
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_service_edge_groups.py +0 -133
- zscaler-sdk-python-0.1.1/tests/integration/zpa/test_trusted_networks.py +0 -85
- zscaler-sdk-python-0.1.1/tests/test_utils.py +0 -102
- zscaler-sdk-python-0.1.1/tox.ini +0 -10
- zscaler-sdk-python-0.1.1/zscaler/errors/__init__.py +0 -0
- zscaler-sdk-python-0.1.1/zscaler/ratelimiter/__init__.py +0 -0
- zscaler-sdk-python-0.1.1/zscaler_sdk_python.egg-info/SOURCES.txt +0 -194
- zscaler-sdk-python-0.1.1/zscaler_sdk_python.egg-info/dependency_links.txt +0 -1
- zscaler-sdk-python-0.1.1/zscaler_sdk_python.egg-info/requires.txt +0 -33
- zscaler-sdk-python-0.1.1/zscaler_sdk_python.egg-info/top_level.txt +0 -1
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/LICENSE.md +0 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/README.md +0 -0
- {zscaler-sdk-python-0.1.1/tests → zscaler_sdk_python-0.1.3/zscaler/cache}/__init__.py +0 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/cache/cache.py +0 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/constants.py +0 -0
- {zscaler-sdk-python-0.1.1/tests/integration/zpa → zscaler_sdk_python-0.1.3/zscaler/errors}/__init__.py +0 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/errors/error.py +0 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/errors/http_error.py +0 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/exceptions/__init__.py +0 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/exceptions/exceptions.py +0 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/logger.py +0 -0
- {zscaler-sdk-python-0.1.1/zscaler/cache → zscaler_sdk_python-0.1.3/zscaler/ratelimiter}/__init__.py +0 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/activate.py +0 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/apptotal.py +0 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/client.py +0 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/device_management.py +0 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/errors.py +0 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/isolation_profile.py +0 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/workload_groups.py +0 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/README.md +0 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/client.py +0 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/cloud_connector_groups.py +0 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/errors.py +0 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/idp.py +0 -0
- {zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zpa/machine_groups.py +0 -0
|
@@ -1,23 +1,51 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: zscaler-sdk-python
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: Official Python SDK for the Zscaler Products (Beta)
|
|
5
|
-
Home-page: https://zscaler-sdk-python
|
|
5
|
+
Home-page: https://github.com/zscaler/zscaler-sdk-python
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: zscaler,sdk,zpa,zia,zdx,zcc,zcon
|
|
6
8
|
Author: Zscaler, Inc.
|
|
7
9
|
Author-email: devrel@zscaler.com
|
|
8
|
-
|
|
10
|
+
Requires-Python: >=3.8,<4.0
|
|
9
11
|
Classifier: Development Status :: 4 - Beta
|
|
10
12
|
Classifier: Intended Audience :: Developers
|
|
11
13
|
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
16
|
Classifier: Programming Language :: Python :: 3.8
|
|
13
17
|
Classifier: Programming Language :: Python :: 3.9
|
|
14
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
15
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
-
Classifier:
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Security
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
23
|
Provides-Extra: dev
|
|
20
|
-
|
|
24
|
+
Requires-Dist: aenum ; extra == "dev"
|
|
25
|
+
Requires-Dist: arrow
|
|
26
|
+
Requires-Dist: black (>=24.4.1,<25.0.0) ; extra == "dev"
|
|
27
|
+
Requires-Dist: certifi
|
|
28
|
+
Requires-Dist: charset-normalizer
|
|
29
|
+
Requires-Dist: flake8
|
|
30
|
+
Requires-Dist: flatdict
|
|
31
|
+
Requires-Dist: idna
|
|
32
|
+
Requires-Dist: pycryptodomex
|
|
33
|
+
Requires-Dist: pydash ; extra == "dev"
|
|
34
|
+
Requires-Dist: python-box (>=5.4,<6.0)
|
|
35
|
+
Requires-Dist: python-dateutil
|
|
36
|
+
Requires-Dist: pytz
|
|
37
|
+
Requires-Dist: pyyaml
|
|
38
|
+
Requires-Dist: requests
|
|
39
|
+
Requires-Dist: responses
|
|
40
|
+
Requires-Dist: restfly
|
|
41
|
+
Requires-Dist: six
|
|
42
|
+
Requires-Dist: urllib3
|
|
43
|
+
Requires-Dist: xmltodict
|
|
44
|
+
Requires-Dist: yarl
|
|
45
|
+
Project-URL: Bug Tracker, https://github.com/zscaler/zscaler-sdk-python/issues
|
|
46
|
+
Project-URL: Documentation, https://zscaler-sdk-python.readthedocs.io
|
|
47
|
+
Project-URL: Repository, https://github.com/zscaler/zscaler-sdk-python
|
|
48
|
+
Description-Content-Type: text/markdown
|
|
21
49
|
|
|
22
50
|
# Official Python SDK for the Zscaler Products (Beta)
|
|
23
51
|
|
|
@@ -331,3 +359,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
331
359
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
332
360
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
333
361
|
SOFTWARE.
|
|
362
|
+
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "zscaler-sdk-python"
|
|
3
|
+
version = "0.1.3"
|
|
4
|
+
description = "Official Python SDK for the Zscaler Products (Beta)"
|
|
5
|
+
authors = ["Zscaler, Inc. <devrel@zscaler.com>"]
|
|
6
|
+
license = "MIT"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
homepage = "https://github.com/zscaler/zscaler-sdk-python"
|
|
9
|
+
repository = "https://github.com/zscaler/zscaler-sdk-python"
|
|
10
|
+
documentation = "https://zscaler-sdk-python.readthedocs.io"
|
|
11
|
+
keywords = ["zscaler", "sdk", "zpa", "zia", "zdx", "zcc", "zcon"]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 4 - Beta",
|
|
14
|
+
"Intended Audience :: Developers",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Programming Language :: Python :: 3.8",
|
|
17
|
+
"Programming Language :: Python :: 3.9",
|
|
18
|
+
"Programming Language :: Python :: 3.10",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
"Topic :: Security",
|
|
22
|
+
"Topic :: Software Development :: Libraries :: Python Modules", ]
|
|
23
|
+
packages = [
|
|
24
|
+
{ include = "zscaler" }
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[tool.poetry.urls]
|
|
28
|
+
"Bug Tracker" = "https://github.com/zscaler/zscaler-sdk-python/issues"
|
|
29
|
+
|
|
30
|
+
[tool.poetry.dependencies]
|
|
31
|
+
python = ">=3.8,<4.0"
|
|
32
|
+
arrow = "*"
|
|
33
|
+
certifi = "*"
|
|
34
|
+
charset-normalizer = "*"
|
|
35
|
+
idna = "*"
|
|
36
|
+
python-box = "^5.4"
|
|
37
|
+
python-dateutil = "*"
|
|
38
|
+
requests = "*"
|
|
39
|
+
responses = "*"
|
|
40
|
+
restfly = "*"
|
|
41
|
+
six = "*"
|
|
42
|
+
urllib3 = "*"
|
|
43
|
+
flatdict = "*"
|
|
44
|
+
pyyaml = "*"
|
|
45
|
+
xmltodict = "*"
|
|
46
|
+
yarl = "*"
|
|
47
|
+
pycryptodomex = "*"
|
|
48
|
+
aenum = "*"
|
|
49
|
+
pydash = "*"
|
|
50
|
+
flake8 = "*"
|
|
51
|
+
pytz = "*"
|
|
52
|
+
black = "^24.4.1"
|
|
53
|
+
|
|
54
|
+
[tool.poetry.dev-dependencies]
|
|
55
|
+
black = "*"
|
|
56
|
+
pytest = "*"
|
|
57
|
+
pytest-asyncio = "*"
|
|
58
|
+
pytest-mock = "*"
|
|
59
|
+
pytest-recording = "*"
|
|
60
|
+
pytest-cov = "*"
|
|
61
|
+
pyfakefs = "*"
|
|
62
|
+
isort = "*"
|
|
63
|
+
wheel = "*"
|
|
64
|
+
sphinx = "*"
|
|
65
|
+
sphinx-autobuild = "*"
|
|
66
|
+
sphinx_rtd_theme = "*"
|
|
67
|
+
|
|
68
|
+
[tool.poetry.extras]
|
|
69
|
+
dev = ["black", "pytest", "pytest-asyncio", "pytest-mock", "pytest-recording", "pytest-cov", "pyfakefs", "aenum", "isort", "wheel", "pydash"]
|
|
70
|
+
|
|
71
|
+
[build-system]
|
|
72
|
+
requires = ["poetry-core>=1.0.0"]
|
|
73
|
+
build-backend = "poetry.core.masonry.api"
|
|
74
|
+
|
|
75
|
+
[tool.black]
|
|
76
|
+
line-length = 127
|
|
77
|
+
|
|
78
|
+
[tool.pylint.'MESSAGES CONTROL']
|
|
79
|
+
disable=[
|
|
80
|
+
"format",
|
|
81
|
+
"missing-module-docstring",
|
|
82
|
+
"missing-class-docstring",
|
|
83
|
+
"missing-function-docstring",
|
|
84
|
+
"too-many-public-methods",
|
|
85
|
+
"anomalous-backslash-in-string",
|
|
86
|
+
"import-error",
|
|
87
|
+
"redefined-outer-name",
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
[tool.pylint.'FORMAT']
|
|
91
|
+
max-line-length = 127
|
|
92
|
+
|
|
93
|
+
[tool.isort]
|
|
94
|
+
profile = "black"
|
|
@@ -14,13 +14,22 @@
|
|
|
14
14
|
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
15
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
16
16
|
|
|
17
|
+
"""Official Python SDK for the Zscaler Products (Beta)
|
|
18
|
+
|
|
19
|
+
Zscaler SDK Python is an SDK that provides a uniform and easy-to-use
|
|
20
|
+
interface for each of the Zscaler product APIs.
|
|
21
|
+
|
|
22
|
+
Documentation available at https://zscaler-sdk-python.readthedocs.io
|
|
23
|
+
|
|
24
|
+
"""
|
|
25
|
+
|
|
17
26
|
__author__ = "Zscaler Inc"
|
|
18
27
|
__email__ = "devrel@zscaler.com"
|
|
19
28
|
__license__ = "MIT"
|
|
20
29
|
__contributors__ = [
|
|
21
30
|
"William Guilherme",
|
|
22
31
|
]
|
|
23
|
-
__version__ = "0.1.
|
|
32
|
+
__version__ = "0.1.3"
|
|
24
33
|
|
|
25
34
|
from zscaler.zia import ZIAClientHelper # noqa
|
|
26
35
|
from zscaler.zpa import ZPAClientHelper # noqa
|
|
@@ -3,9 +3,7 @@ import logging
|
|
|
3
3
|
from zscaler.cache.cache import Cache
|
|
4
4
|
|
|
5
5
|
# Setting up the logger
|
|
6
|
-
logging.basicConfig(
|
|
7
|
-
level=logging.DEBUG, format="%(asctime)s - %(levelname)s - %(message)s"
|
|
8
|
-
)
|
|
6
|
+
logging.basicConfig(level=logging.DEBUG, format="%(asctime)s - %(levelname)s - %(message)s")
|
|
9
7
|
|
|
10
8
|
|
|
11
9
|
class NoOpCache(Cache):
|
|
@@ -107,9 +107,7 @@ class ZscalerCache(Cache):
|
|
|
107
107
|
for other_key in self._store.keys():
|
|
108
108
|
other_url_object = urlparse(other_key)
|
|
109
109
|
other_base_url = f"{other_url_object.netloc}{other_url_object.path}"
|
|
110
|
-
if not self._is_valid_entry(
|
|
111
|
-
self._store[other_key]
|
|
112
|
-
) and other_base_url.startswith(base_url):
|
|
110
|
+
if not self._is_valid_entry(self._store[other_key]) and other_base_url.startswith(base_url):
|
|
113
111
|
del self._store[other_key]
|
|
114
112
|
logger.info(f'Removed also value from cache for key "{other_key}".')
|
|
115
113
|
|
|
@@ -15,10 +15,7 @@ class ZPAAPIError(Error):
|
|
|
15
15
|
self.headers = response_details.headers
|
|
16
16
|
self.stack = ""
|
|
17
17
|
|
|
18
|
-
self.message =
|
|
19
|
-
f"ZPA HTTP {self.status} {self.error_id} "
|
|
20
|
-
f"{self.reason}\nParameters: {params_string}"
|
|
21
|
-
)
|
|
18
|
+
self.message = f"ZPA HTTP {self.status} {self.error_id} " f"{self.reason}\nParameters: {params_string}"
|
|
22
19
|
|
|
23
20
|
|
|
24
21
|
# ZIA API Errors
|
|
@@ -3,9 +3,7 @@ import time
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class RateLimiter:
|
|
6
|
-
def __init__(
|
|
7
|
-
self, get_limit, post_put_delete_limit, get_freq, post_put_delete_freq
|
|
8
|
-
):
|
|
6
|
+
def __init__(self, get_limit, post_put_delete_limit, get_freq, post_put_delete_freq):
|
|
9
7
|
self.lock = threading.Lock()
|
|
10
8
|
self.get_requests = []
|
|
11
9
|
self.post_put_delete_requests = []
|
|
@@ -12,9 +12,7 @@ class UserAgent:
|
|
|
12
12
|
os_name = platform.system()
|
|
13
13
|
os_version = platform.release()
|
|
14
14
|
self._user_agent_string = (
|
|
15
|
-
f"{UserAgent.SDK_NAME}/{VERSION} "
|
|
16
|
-
f"{UserAgent.PYTHON}/{python_version} "
|
|
17
|
-
f"{os_name}/{os_version}"
|
|
15
|
+
f"{UserAgent.SDK_NAME}/{VERSION} " f"{UserAgent.PYTHON}/{python_version} " f"{os_name}/{os_version}"
|
|
18
16
|
)
|
|
19
17
|
if user_agent_extra:
|
|
20
18
|
self._user_agent_string += f" {user_agent_extra}"
|
|
@@ -47,9 +47,7 @@ def convert_keys_to_snake(data):
|
|
|
47
47
|
for k in data.keys():
|
|
48
48
|
v = data[k]
|
|
49
49
|
new_key = camel_to_snake(k)
|
|
50
|
-
new_dict[new_key] = (
|
|
51
|
-
convert_keys_to_snake(v) if isinstance(v, (dict, list)) else v
|
|
52
|
-
)
|
|
50
|
+
new_dict[new_key] = convert_keys_to_snake(v) if isinstance(v, (dict, list)) else v
|
|
53
51
|
return new_dict
|
|
54
52
|
else:
|
|
55
53
|
return data
|
|
@@ -92,10 +90,7 @@ def snake_to_camel(name: str):
|
|
|
92
90
|
def recursive_snake_to_camel(data):
|
|
93
91
|
"""Recursively convert dictionary keys from snake_case to camelCase."""
|
|
94
92
|
if isinstance(data, dict):
|
|
95
|
-
return {
|
|
96
|
-
snake_to_camel(key): recursive_snake_to_camel(value)
|
|
97
|
-
for key, value in data.items()
|
|
98
|
-
}
|
|
93
|
+
return {snake_to_camel(key): recursive_snake_to_camel(value) for key, value in data.items()}
|
|
99
94
|
elif isinstance(data, list):
|
|
100
95
|
return [recursive_snake_to_camel(item) for item in data]
|
|
101
96
|
else:
|
|
@@ -156,9 +151,7 @@ def transform_common_id_fields(id_groups: list, kwargs: dict, payload: dict):
|
|
|
156
151
|
for entry in id_groups:
|
|
157
152
|
if kwargs.get(entry[0]):
|
|
158
153
|
# Ensure each ID is treated as an integer before adding it to the payload
|
|
159
|
-
payload[entry[1]] = [
|
|
160
|
-
{"id": int(param_id)} for param_id in kwargs.pop(entry[0])
|
|
161
|
-
]
|
|
154
|
+
payload[entry[1]] = [{"id": int(param_id)} for param_id in kwargs.pop(entry[0])]
|
|
162
155
|
return
|
|
163
156
|
|
|
164
157
|
|
|
@@ -249,11 +242,7 @@ def format_json_response(
|
|
|
249
242
|
if response.status_code > 299:
|
|
250
243
|
return response
|
|
251
244
|
content_type = response.headers.get("content-type", "application/json")
|
|
252
|
-
if (
|
|
253
|
-
(conv_json or conv_box)
|
|
254
|
-
and "application/json" in content_type.lower()
|
|
255
|
-
and len(response.text) > 0
|
|
256
|
-
): # noqa: E124
|
|
245
|
+
if (conv_json or conv_box) and "application/json" in content_type.lower() and len(response.text) > 0: # noqa: E124
|
|
257
246
|
if conv_box:
|
|
258
247
|
data = convert_keys_to_snake(response.json())
|
|
259
248
|
if isinstance(data, list):
|
|
@@ -363,11 +352,7 @@ def retry_with_backoff(method_type="GET", retries=5, backoff_in_seconds=0.5):
|
|
|
363
352
|
resp = f(*args, **kwargs)
|
|
364
353
|
|
|
365
354
|
# Check if it's a successful status code, 400, or if it shouldn't be retried
|
|
366
|
-
if (
|
|
367
|
-
299 >= resp.status_code >= 200
|
|
368
|
-
or resp.status_code == 400
|
|
369
|
-
or not should_retry(resp.status_code)
|
|
370
|
-
):
|
|
355
|
+
if 299 >= resp.status_code >= 200 or resp.status_code == 400 or not should_retry(resp.status_code):
|
|
371
356
|
return resp
|
|
372
357
|
|
|
373
358
|
if x == retries:
|
|
@@ -378,9 +363,7 @@ def retry_with_backoff(method_type="GET", retries=5, backoff_in_seconds=0.5):
|
|
|
378
363
|
raise Exception(f"Reached max retries. Response: {error_msg}")
|
|
379
364
|
else:
|
|
380
365
|
sleep = backoff_in_seconds * 2**x + random.uniform(0, 1)
|
|
381
|
-
logger.info(
|
|
382
|
-
"Args: %s, retrying after %d seconds...", str(args), sleep
|
|
383
|
-
)
|
|
366
|
+
logger.info("Args: %s, retrying after %d seconds...", str(args), sleep)
|
|
384
367
|
time.sleep(sleep)
|
|
385
368
|
x += 1
|
|
386
369
|
|
|
@@ -402,9 +385,7 @@ def is_token_expired(token_string):
|
|
|
402
385
|
return True
|
|
403
386
|
|
|
404
387
|
# Decode the payload
|
|
405
|
-
payload_bytes = base64.urlsafe_b64decode(
|
|
406
|
-
parts[1] + "=="
|
|
407
|
-
) # Padding might be needed
|
|
388
|
+
payload_bytes = base64.urlsafe_b64decode(parts[1] + "==") # Padding might be needed
|
|
408
389
|
payload = jsonp.loads(payload_bytes)
|
|
409
390
|
|
|
410
391
|
# Check expiration time
|
|
@@ -501,12 +482,8 @@ def validate_and_convert_times(start_time_str, end_time_str, time_zone_str):
|
|
|
501
482
|
return start_epoch, end_epoch
|
|
502
483
|
|
|
503
484
|
|
|
504
|
-
def dump_request(
|
|
505
|
-
|
|
506
|
-
):
|
|
507
|
-
request_headers_filtered = {
|
|
508
|
-
key: value for key, value in headers.items() if key != "Authorization"
|
|
509
|
-
}
|
|
485
|
+
def dump_request(logger, url: str, method: str, json, params, headers, request_uuid: str, body=True):
|
|
486
|
+
request_headers_filtered = {key: value for key, value in headers.items() if key != "Authorization"}
|
|
510
487
|
# Log the request details before sending the request
|
|
511
488
|
request_data = {
|
|
512
489
|
"url": url,
|
|
@@ -519,17 +496,13 @@ def dump_request(
|
|
|
519
496
|
request_body = ""
|
|
520
497
|
if body:
|
|
521
498
|
request_body = jsonp.dumps(json)
|
|
522
|
-
log_lines.append(
|
|
523
|
-
f"\n---[ ZSCALER SDK REQUEST | ID:{request_uuid} ]-------------------------------"
|
|
524
|
-
)
|
|
499
|
+
log_lines.append(f"\n---[ ZSCALER SDK REQUEST | ID:{request_uuid} ]-------------------------------")
|
|
525
500
|
log_lines.append(f"{method} {url}")
|
|
526
501
|
for key, value in headers.items():
|
|
527
502
|
log_lines.append(f"{key}: {value}")
|
|
528
503
|
if body and request_body != "" and request_body != "null":
|
|
529
504
|
log_lines.append(f"\n{request_body}")
|
|
530
|
-
log_lines.append(
|
|
531
|
-
"--------------------------------------------------------------------"
|
|
532
|
-
)
|
|
505
|
+
log_lines.append("--------------------------------------------------------------------")
|
|
533
506
|
logger.info("\n".join(log_lines))
|
|
534
507
|
|
|
535
508
|
|
|
@@ -560,14 +533,10 @@ def dump_response(
|
|
|
560
533
|
|
|
561
534
|
if from_cache:
|
|
562
535
|
log_lines.append(
|
|
563
|
-
f"\n---[ ZSCALER SDK RESPONSE | ID:{request_uuid} | "
|
|
564
|
-
f"FROM CACHE | DURATION:{duration_ms}ms ]" + "-" * 31
|
|
536
|
+
f"\n---[ ZSCALER SDK RESPONSE | ID:{request_uuid} | " f"FROM CACHE | DURATION:{duration_ms}ms ]" + "-" * 31
|
|
565
537
|
)
|
|
566
538
|
else:
|
|
567
|
-
log_lines.append(
|
|
568
|
-
f"\n---[ ZSCALER SDK RESPONSE | ID:{request_uuid} | "
|
|
569
|
-
f"DURATION:{duration_ms}ms ]" + "-" * 46
|
|
570
|
-
)
|
|
539
|
+
log_lines.append(f"\n---[ ZSCALER SDK RESPONSE | ID:{request_uuid} | " f"DURATION:{duration_ms}ms ]" + "-" * 46)
|
|
571
540
|
log_lines.append(f"{method} {full_url}")
|
|
572
541
|
for key, value in response_headers_dict.items():
|
|
573
542
|
log_lines.append(f"{key}: {value}")
|
|
@@ -97,9 +97,7 @@ class ZIAClientHelper(ZIAClient):
|
|
|
97
97
|
self.username = kw.get("username", os.getenv(f"{self._env_base}_USERNAME"))
|
|
98
98
|
self.password = kw.get("password", os.getenv(f"{self._env_base}_PASSWORD"))
|
|
99
99
|
# The 'cloud' parameter should have precedence over environment variables
|
|
100
|
-
self.env_cloud = (
|
|
101
|
-
cloud or kw.get("cloud") or os.getenv(f"{self._env_base}_CLOUD")
|
|
102
|
-
)
|
|
100
|
+
self.env_cloud = cloud or kw.get("cloud") or os.getenv(f"{self._env_base}_CLOUD")
|
|
103
101
|
if not self.env_cloud:
|
|
104
102
|
raise ValueError(
|
|
105
103
|
f"Cloud environment must be set via the 'cloud' argument or the {self._env_base}_CLOUD environment variable."
|
|
@@ -117,14 +115,10 @@ class ZIAClientHelper(ZIAClient):
|
|
|
117
115
|
)
|
|
118
116
|
|
|
119
117
|
self.conv_box = True
|
|
120
|
-
self.sandbox_token = kw.get("sandbox_token") or os.getenv(
|
|
121
|
-
f"{self._env_base}_SANDBOX_TOKEN"
|
|
122
|
-
)
|
|
118
|
+
self.sandbox_token = kw.get("sandbox_token") or os.getenv(f"{self._env_base}_SANDBOX_TOKEN")
|
|
123
119
|
self.timeout = timeout
|
|
124
120
|
self.fail_safe = fail_safe
|
|
125
|
-
cache_enabled = (
|
|
126
|
-
os.environ.get("ZSCALER_CLIENT_CACHE_ENABLED", "true").lower() == "true"
|
|
127
|
-
)
|
|
121
|
+
cache_enabled = os.environ.get("ZSCALER_CLIENT_CACHE_ENABLED", "true").lower() == "true"
|
|
128
122
|
if cache is None:
|
|
129
123
|
if cache_enabled:
|
|
130
124
|
ttl = int(os.environ.get("ZSCALER_CLIENT_CACHE_DEFAULT_TTL", 3600))
|
|
@@ -175,9 +169,7 @@ class ZIAClientHelper(ZIAClient):
|
|
|
175
169
|
return True
|
|
176
170
|
now = datetime.datetime.now()
|
|
177
171
|
if self.auth_details["passwordExpiryTime"] > 0 and (
|
|
178
|
-
self.session_refreshed
|
|
179
|
-
+ datetime.timedelta(seconds=-self.session_timeout_offset)
|
|
180
|
-
< now
|
|
172
|
+
self.session_refreshed + datetime.timedelta(seconds=-self.session_timeout_offset) < now
|
|
181
173
|
):
|
|
182
174
|
return True
|
|
183
175
|
return False
|
|
@@ -220,9 +212,7 @@ class ZIAClientHelper(ZIAClient):
|
|
|
220
212
|
headers.update({"Cookie": f"JSESSIONID={self.session_id}"})
|
|
221
213
|
|
|
222
214
|
try:
|
|
223
|
-
response = requests.delete(
|
|
224
|
-
logout_url, headers=headers, timeout=self.timeout
|
|
225
|
-
)
|
|
215
|
+
response = requests.delete(logout_url, headers=headers, timeout=self.timeout)
|
|
226
216
|
if response.status_code == 204:
|
|
227
217
|
self.session_id = None
|
|
228
218
|
self.auth_details = None
|
|
@@ -308,15 +298,11 @@ class ZIAClientHelper(ZIAClient):
|
|
|
308
298
|
request_uuid=request_uuid,
|
|
309
299
|
start_time=start_time,
|
|
310
300
|
)
|
|
311
|
-
if
|
|
312
|
-
resp.status_code == 429
|
|
313
|
-
): # HTTP Status code 429 indicates "Too Many Requests"
|
|
301
|
+
if resp.status_code == 429: # HTTP Status code 429 indicates "Too Many Requests"
|
|
314
302
|
sleep_time = int(
|
|
315
303
|
resp.headers.get("Retry-After", 2)
|
|
316
304
|
) # Default to 60 seconds if 'Retry-After' header is missing
|
|
317
|
-
logger.warning(
|
|
318
|
-
f"Rate limit exceeded. Retrying in {sleep_time} seconds."
|
|
319
|
-
)
|
|
305
|
+
logger.warning(f"Rate limit exceeded. Retrying in {sleep_time} seconds.")
|
|
320
306
|
sleep(sleep_time)
|
|
321
307
|
attempts += 1
|
|
322
308
|
continue
|
|
@@ -324,14 +310,10 @@ class ZIAClientHelper(ZIAClient):
|
|
|
324
310
|
break
|
|
325
311
|
except requests.RequestException as e:
|
|
326
312
|
if attempts == 4: # If it's the last attempt, raise the exception
|
|
327
|
-
logger.error(
|
|
328
|
-
f"Failed to send {method} request to {url} after 5 attempts. Error: {str(e)}"
|
|
329
|
-
)
|
|
313
|
+
logger.error(f"Failed to send {method} request to {url} after 5 attempts. Error: {str(e)}")
|
|
330
314
|
raise e
|
|
331
315
|
else:
|
|
332
|
-
logger.warning(
|
|
333
|
-
f"Failed to send {method} request to {url}. Retrying... Error: {str(e)}"
|
|
334
|
-
)
|
|
316
|
+
logger.warning(f"Failed to send {method} request to {url}. Retrying... Error: {str(e)}")
|
|
335
317
|
attempts += 1
|
|
336
318
|
sleep(5) # Sleep for 5 seconds before retrying
|
|
337
319
|
|
|
@@ -413,9 +395,7 @@ class ZIAClientHelper(ZIAClient):
|
|
|
413
395
|
"EMPTY_RESULTS": "No results found for page {page}.",
|
|
414
396
|
}
|
|
415
397
|
|
|
416
|
-
def get_paginated_data(
|
|
417
|
-
self, path=None, data_key_name=None, data_per_page=5, expected_status_code=200
|
|
418
|
-
):
|
|
398
|
+
def get_paginated_data(self, path=None, data_key_name=None, data_per_page=5, expected_status_code=200):
|
|
419
399
|
"""
|
|
420
400
|
Fetch paginated data from the ZIA API.
|
|
421
401
|
...
|
|
@@ -443,9 +423,7 @@ class ZIAClientHelper(ZIAClient):
|
|
|
443
423
|
)
|
|
444
424
|
|
|
445
425
|
if response.status_code != expected_status_code:
|
|
446
|
-
error_message = self.ERROR_MESSAGES["UNEXPECTED_STATUS"].format(
|
|
447
|
-
status_code=response.status_code, page=page
|
|
448
|
-
)
|
|
426
|
+
error_message = self.ERROR_MESSAGES["UNEXPECTED_STATUS"].format(status_code=response.status_code, page=page)
|
|
449
427
|
logger.error(error_message)
|
|
450
428
|
break
|
|
451
429
|
data_json = response.json()
|
|
@@ -455,9 +433,7 @@ class ZIAClientHelper(ZIAClient):
|
|
|
455
433
|
data = data_json.get(data_key_name)
|
|
456
434
|
|
|
457
435
|
if data is None:
|
|
458
|
-
error_message = self.ERROR_MESSAGES["MISSING_DATA_KEY"].format(
|
|
459
|
-
data_key_name=data_key_name, page=page
|
|
460
|
-
)
|
|
436
|
+
error_message = self.ERROR_MESSAGES["MISSING_DATA_KEY"].format(data_key_name=data_key_name, page=page)
|
|
461
437
|
logger.error(error_message)
|
|
462
438
|
break
|
|
463
439
|
|
|
@@ -468,11 +444,7 @@ class ZIAClientHelper(ZIAClient):
|
|
|
468
444
|
ret_data.extend(convert_keys_to_snake(data))
|
|
469
445
|
|
|
470
446
|
# Check for more pages
|
|
471
|
-
if (
|
|
472
|
-
len(data) == 0
|
|
473
|
-
or isinstance(data_json, dict)
|
|
474
|
-
and int(response.json().get("totalPages")) <= page + 1
|
|
475
|
-
):
|
|
447
|
+
if len(data) == 0 or isinstance(data_json, dict) and int(response.json().get("totalPages")) <= page + 1:
|
|
476
448
|
break
|
|
477
449
|
|
|
478
450
|
page += 1
|
{zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/admin_and_role_management.py
RENAMED
|
@@ -71,9 +71,7 @@ class AdminAndRoleManagementAPI:
|
|
|
71
71
|
return None
|
|
72
72
|
return response
|
|
73
73
|
|
|
74
|
-
def add_user(
|
|
75
|
-
self, name: str, login_name: str, email: str, password: str, **kwargs
|
|
76
|
-
) -> Box:
|
|
74
|
+
def add_user(self, name: str, login_name: str, email: str, password: str, **kwargs) -> Box:
|
|
77
75
|
"""
|
|
78
76
|
Adds a new admin user to ZIA.
|
|
79
77
|
|
|
@@ -174,9 +172,7 @@ class AdminAndRoleManagementAPI:
|
|
|
174
172
|
# Handle error response
|
|
175
173
|
status_code = response.status_code
|
|
176
174
|
if status_code != 200:
|
|
177
|
-
raise Exception(
|
|
178
|
-
f"API call failed with status {status_code}: {response.json()}"
|
|
179
|
-
)
|
|
175
|
+
raise Exception(f"API call failed with status {status_code}: {response.json()}")
|
|
180
176
|
return response
|
|
181
177
|
|
|
182
178
|
def update_user(self, user_id: str, **kwargs) -> dict:
|
|
@@ -264,9 +260,7 @@ class AdminAndRoleManagementAPI:
|
|
|
264
260
|
response = self.rest.put("/adminUsers/%s" % (user_id), json=payload)
|
|
265
261
|
if isinstance(response, Response) and not response.ok:
|
|
266
262
|
# Handle error response
|
|
267
|
-
raise Exception(
|
|
268
|
-
f"API call failed with status {response.status_code}: {response.json()}"
|
|
269
|
-
)
|
|
263
|
+
raise Exception(f"API call failed with status {response.status_code}: {response.json()}")
|
|
270
264
|
|
|
271
265
|
# Return the updated object
|
|
272
266
|
return self.get_user(user_id)
|
|
@@ -61,9 +61,7 @@ class AuditLogsAPI:
|
|
|
61
61
|
"startTime": start_time,
|
|
62
62
|
"endTime": end_time,
|
|
63
63
|
}
|
|
64
|
-
return self.rest.post(
|
|
65
|
-
"auditlogEntryReport", json=payload, box=False
|
|
66
|
-
).status_code
|
|
64
|
+
return self.rest.post("auditlogEntryReport", json=payload, box=False).status_code
|
|
67
65
|
|
|
68
66
|
def cancel(self) -> int:
|
|
69
67
|
"""
|
{zscaler-sdk-python-0.1.1 → zscaler_sdk_python-0.1.3}/zscaler/zia/authentication_settings.py
RENAMED
|
@@ -58,9 +58,7 @@ class AuthenticationSettingsAPI:
|
|
|
58
58
|
|
|
59
59
|
payload = {"urls": url_list}
|
|
60
60
|
|
|
61
|
-
resp = self.rest.post(
|
|
62
|
-
"authSettings/exemptedUrls?action=ADD_TO_LIST", json=payload
|
|
63
|
-
)
|
|
61
|
+
resp = self.rest.post("authSettings/exemptedUrls?action=ADD_TO_LIST", json=payload)
|
|
64
62
|
|
|
65
63
|
# Check if the response object has a 'status_code' attribute before accessing it
|
|
66
64
|
if hasattr(resp, "status_code"):
|
|
@@ -89,9 +87,7 @@ class AuthenticationSettingsAPI:
|
|
|
89
87
|
|
|
90
88
|
"""
|
|
91
89
|
payload = {"urls": url_list}
|
|
92
|
-
resp = self.rest.post(
|
|
93
|
-
"authSettings/exemptedUrls?action=REMOVE_FROM_LIST", json=payload
|
|
94
|
-
)
|
|
90
|
+
resp = self.rest.post("authSettings/exemptedUrls?action=REMOVE_FROM_LIST", json=payload)
|
|
95
91
|
|
|
96
92
|
# Return the updated exemption list if the removal was successful.
|
|
97
93
|
if resp == 200:
|
|
@@ -295,9 +295,7 @@ class CloudAppsAPI:
|
|
|
295
295
|
|
|
296
296
|
return self.rest.post("shadowIT/applications/export", json=payload).text
|
|
297
297
|
|
|
298
|
-
def export_shadow_it_csv(
|
|
299
|
-
self, application: str, entity: str, duration: str = "LAST_1_DAYS", **kwargs
|
|
300
|
-
):
|
|
298
|
+
def export_shadow_it_csv(self, application: str, entity: str, duration: str = "LAST_1_DAYS", **kwargs):
|
|
301
299
|
"""
|
|
302
300
|
Export the Shadow IT Report (in CSV format) for the list of users or known locations
|
|
303
301
|
identified with using the cloud applications specified in the request. The report
|
|
@@ -367,9 +365,7 @@ class CloudAppsAPI:
|
|
|
367
365
|
|
|
368
366
|
convert_keys(payload.update(kwargs))
|
|
369
367
|
|
|
370
|
-
return self.rest.post(
|
|
371
|
-
f"shadowIT/applications/{entity}/exportCsv", json=payload
|
|
372
|
-
).text
|
|
368
|
+
return self.rest.post(f"shadowIT/applications/{entity}/exportCsv", json=payload).text
|
|
373
369
|
|
|
374
370
|
def list_apps(self):
|
|
375
371
|
"""
|