zscaler-sdk-python 1.0.0__py2.py3-none-any.whl
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/__init__.py +34 -0
- zscaler/cache/__init__.py +0 -0
- zscaler/cache/cache.py +105 -0
- zscaler/cache/no_op_cache.py +68 -0
- zscaler/cache/zscaler_cache.py +161 -0
- zscaler/constants.py +26 -0
- zscaler/errors/__init__.py +0 -0
- zscaler/errors/error.py +10 -0
- zscaler/errors/http_error.py +20 -0
- zscaler/errors/zscaler_api_error.py +24 -0
- zscaler/exceptions/__init__.py +1 -0
- zscaler/exceptions/exceptions.py +101 -0
- zscaler/logger.py +57 -0
- zscaler/ratelimiter/__init__.py +0 -0
- zscaler/ratelimiter/ratelimiter.py +39 -0
- zscaler/user_agent.py +23 -0
- zscaler/utils.py +577 -0
- zscaler/zia/__init__.py +657 -0
- zscaler/zia/activate.py +52 -0
- zscaler/zia/admin_and_role_management.py +344 -0
- zscaler/zia/apptotal.py +71 -0
- zscaler/zia/audit_logs.py +95 -0
- zscaler/zia/authentication_settings.py +98 -0
- zscaler/zia/client.py +88 -0
- zscaler/zia/cloud_apps.py +406 -0
- zscaler/zia/device_management.py +90 -0
- zscaler/zia/dlp.py +784 -0
- zscaler/zia/errors.py +37 -0
- zscaler/zia/firewall.py +1104 -0
- zscaler/zia/forwarding_control.py +271 -0
- zscaler/zia/isolation_profile.py +83 -0
- zscaler/zia/labels.py +180 -0
- zscaler/zia/locations.py +661 -0
- zscaler/zia/sandbox.py +180 -0
- zscaler/zia/security.py +236 -0
- zscaler/zia/ssl_inspection.py +175 -0
- zscaler/zia/traffic.py +853 -0
- zscaler/zia/url_categories.py +442 -0
- zscaler/zia/url_filtering.py +310 -0
- zscaler/zia/users.py +386 -0
- zscaler/zia/web_dlp.py +295 -0
- zscaler/zia/workload_groups.py +58 -0
- zscaler/zia/zpa_gateway.py +187 -0
- zscaler/zpa/__init__.py +683 -0
- zscaler/zpa/app_segments.py +331 -0
- zscaler/zpa/app_segments_inspection.py +311 -0
- zscaler/zpa/app_segments_pra.py +310 -0
- zscaler/zpa/certificates.py +234 -0
- zscaler/zpa/client.py +113 -0
- zscaler/zpa/cloud_connector_groups.py +75 -0
- zscaler/zpa/connectors.py +518 -0
- zscaler/zpa/emergency_access.py +178 -0
- zscaler/zpa/errors.py +37 -0
- zscaler/zpa/idp.py +83 -0
- zscaler/zpa/inspection.py +1012 -0
- zscaler/zpa/isolation_profile.py +85 -0
- zscaler/zpa/lss.py +568 -0
- zscaler/zpa/machine_groups.py +79 -0
- zscaler/zpa/policies.py +848 -0
- zscaler/zpa/posture_profiles.py +122 -0
- zscaler/zpa/privileged_remote_access.py +862 -0
- zscaler/zpa/provisioning.py +271 -0
- zscaler/zpa/saml_attributes.py +100 -0
- zscaler/zpa/scim_attributes.py +117 -0
- zscaler/zpa/scim_groups.py +146 -0
- zscaler/zpa/segment_groups.py +191 -0
- zscaler/zpa/server_groups.py +217 -0
- zscaler/zpa/servers.py +202 -0
- zscaler/zpa/service_edges.py +404 -0
- zscaler/zpa/trusted_networks.py +127 -0
- zscaler_sdk_python-1.0.0.dist-info/LICENSE.md +21 -0
- zscaler_sdk_python-1.0.0.dist-info/METADATA +59 -0
- zscaler_sdk_python-1.0.0.dist-info/RECORD +75 -0
- zscaler_sdk_python-1.0.0.dist-info/WHEEL +6 -0
- zscaler_sdk_python-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
# Copyright (c) 2023, Zscaler Inc.
|
|
4
|
+
#
|
|
5
|
+
# Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
# purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
# copyright notice and this permission notice appear in all copies.
|
|
8
|
+
#
|
|
9
|
+
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
import time
|
|
19
|
+
|
|
20
|
+
from box import Box, BoxList
|
|
21
|
+
from requests import Response
|
|
22
|
+
|
|
23
|
+
from zscaler.utils import chunker, convert_keys, snake_to_camel
|
|
24
|
+
from zscaler.zia import ZIAClient
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class URLCategoriesAPI:
|
|
28
|
+
def __init__(self, client: ZIAClient):
|
|
29
|
+
self.rest = client
|
|
30
|
+
|
|
31
|
+
def lookup(self, urls: list) -> BoxList:
|
|
32
|
+
"""
|
|
33
|
+
Lookup the category for the provided URLs.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
urls (list):
|
|
37
|
+
The list of URLs to perform a category lookup on.
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
:obj:`BoxList`: A list of URL category reports.
|
|
41
|
+
|
|
42
|
+
Examples:
|
|
43
|
+
>>> zia.url_categories.lookup(['example.com', 'test.com'])
|
|
44
|
+
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
if len(urls) > 100:
|
|
48
|
+
results = BoxList()
|
|
49
|
+
for chunk in chunker(urls, 100):
|
|
50
|
+
results.extend(self._post("urlLookup", json=chunk))
|
|
51
|
+
time.sleep(1)
|
|
52
|
+
return results
|
|
53
|
+
|
|
54
|
+
else:
|
|
55
|
+
payload = urls
|
|
56
|
+
return self.rest.post("urlLookup", json=payload)
|
|
57
|
+
|
|
58
|
+
def list_categories(
|
|
59
|
+
self, custom_only: bool = False, only_counts: bool = False
|
|
60
|
+
) -> BoxList:
|
|
61
|
+
"""
|
|
62
|
+
Returns information on URL categories.
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
custom_only (bool):
|
|
66
|
+
Returns only custom categories if True.
|
|
67
|
+
only_counts (bool):
|
|
68
|
+
Returns only URL and keyword counts if True.
|
|
69
|
+
|
|
70
|
+
Returns:
|
|
71
|
+
:obj:`BoxList`: A list of information for all or custom URL categories.
|
|
72
|
+
|
|
73
|
+
Examples:
|
|
74
|
+
List all URL categories:
|
|
75
|
+
|
|
76
|
+
>>> zia.url_categories.list_categories()
|
|
77
|
+
|
|
78
|
+
List only custom URL categories:
|
|
79
|
+
|
|
80
|
+
>>> zia.url_categories.list_categories(custom_only=True)
|
|
81
|
+
|
|
82
|
+
"""
|
|
83
|
+
payload = {
|
|
84
|
+
"customOnly": custom_only,
|
|
85
|
+
"includeOnlyUrlKeywordCounts": only_counts,
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return self.rest.get("urlCategories", params=payload)
|
|
89
|
+
|
|
90
|
+
def get_category_by_name(self, name):
|
|
91
|
+
categories = self.list_categories()
|
|
92
|
+
for category in categories:
|
|
93
|
+
if category.get("configured_name") == name:
|
|
94
|
+
return category
|
|
95
|
+
return None
|
|
96
|
+
|
|
97
|
+
def get_quota(self) -> Box:
|
|
98
|
+
"""
|
|
99
|
+
Returns information on URL category quota usage.
|
|
100
|
+
|
|
101
|
+
Returns:
|
|
102
|
+
:obj:`Box`: The URL quota statistics.
|
|
103
|
+
|
|
104
|
+
Examples:
|
|
105
|
+
>>> zia.url_categories.get_quota()
|
|
106
|
+
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
return self.rest.get("urlCategories/urlQuota")
|
|
110
|
+
|
|
111
|
+
def get_category(self, category_id: str) -> Box:
|
|
112
|
+
"""
|
|
113
|
+
Returns URL category information for the provided category.
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
category_id (str):
|
|
117
|
+
The unique identifier for the category (e.g. 'MUSIC')
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
:obj:`Box`: The resource record for the category.
|
|
121
|
+
|
|
122
|
+
Examples:
|
|
123
|
+
>>> zia.url_categories.get_category('ALCOHOL_TOBACCO')
|
|
124
|
+
|
|
125
|
+
"""
|
|
126
|
+
return self.rest.get(f"urlCategories/{category_id}")
|
|
127
|
+
|
|
128
|
+
def add_url_category(
|
|
129
|
+
self, configured_name: str, super_category: str, urls: list, **kwargs
|
|
130
|
+
) -> Box:
|
|
131
|
+
"""
|
|
132
|
+
Adds a new custom URL category.
|
|
133
|
+
|
|
134
|
+
Args:
|
|
135
|
+
name (str):
|
|
136
|
+
Name of the URL category.
|
|
137
|
+
super_category (str):
|
|
138
|
+
The name of the parent category.
|
|
139
|
+
urls (list):
|
|
140
|
+
Custom URLs to add to a URL category.
|
|
141
|
+
**kwargs:
|
|
142
|
+
Optional keyword args.
|
|
143
|
+
|
|
144
|
+
Keyword Args:
|
|
145
|
+
db_categorized_urls (list):
|
|
146
|
+
URLs entered will be covered by policies that reference the parent category, in addition to this one.
|
|
147
|
+
description (str):
|
|
148
|
+
Description of the category.
|
|
149
|
+
custom_category (bool):
|
|
150
|
+
Set to true for custom URL category. Up to 48 custom URL categories can be added per organisation.
|
|
151
|
+
ip_ranges (list):
|
|
152
|
+
Custom IP addpress ranges associated to a URL category. This feature must be enabled on your tenancy.
|
|
153
|
+
ip_ranges_retaining_parent_category (list):
|
|
154
|
+
The retaining parent custom IP addess ranges associated to a URL category.
|
|
155
|
+
keywords (list):
|
|
156
|
+
Custom keywords associated to a URL category.
|
|
157
|
+
keywords_retaining_parent_category (list):
|
|
158
|
+
Retained custom keywords from the parent URL category that are associated with a URL category.
|
|
159
|
+
|
|
160
|
+
Returns:
|
|
161
|
+
:obj:`Box`: The newly configured custom URL category resource record.
|
|
162
|
+
|
|
163
|
+
Examples:
|
|
164
|
+
Add a new category for beers that don't taste good:
|
|
165
|
+
|
|
166
|
+
>>> zia.url_categories.add_url_category(name='Beer',
|
|
167
|
+
... super_category='ALCOHOL_TOBACCO',
|
|
168
|
+
... urls=['xxxx.com.au', 'carltondraught.com.au'],
|
|
169
|
+
... description="Beers that don't taste good.")
|
|
170
|
+
|
|
171
|
+
Add a new category with IP ranges:
|
|
172
|
+
|
|
173
|
+
>>> zia.url_categories.add_url_category(name='Beer',
|
|
174
|
+
... super_category='FINANCE',
|
|
175
|
+
... urls=['finance.google.com'],
|
|
176
|
+
... description="Google Finance.",
|
|
177
|
+
... ip_ranges=['10.0.0.0/24'])
|
|
178
|
+
|
|
179
|
+
"""
|
|
180
|
+
|
|
181
|
+
payload = {
|
|
182
|
+
"type": "URL_CATEGORY",
|
|
183
|
+
"superCategory": super_category,
|
|
184
|
+
"configuredName": configured_name,
|
|
185
|
+
"urls": urls,
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
# Add optional parameters to payload
|
|
189
|
+
for key, value in kwargs.items():
|
|
190
|
+
payload[snake_to_camel(key)] = value
|
|
191
|
+
|
|
192
|
+
response = self.rest.post("urlCategories", json=payload)
|
|
193
|
+
if isinstance(response, Response):
|
|
194
|
+
# Handle error response
|
|
195
|
+
status_code = response.status_code
|
|
196
|
+
if status_code != 200:
|
|
197
|
+
raise Exception(
|
|
198
|
+
f"API call failed with status {status_code}: {response.json()}"
|
|
199
|
+
)
|
|
200
|
+
return response
|
|
201
|
+
|
|
202
|
+
def add_tld_category(self, name: str, tlds: list, **kwargs) -> Box:
|
|
203
|
+
"""
|
|
204
|
+
Adds a new custom TLD category.
|
|
205
|
+
|
|
206
|
+
Args:
|
|
207
|
+
name (str):
|
|
208
|
+
The name of the TLD category.
|
|
209
|
+
tlds (list):
|
|
210
|
+
A list of TLDs in the format '.tld'.
|
|
211
|
+
**kwargs:
|
|
212
|
+
Optional keyword args.
|
|
213
|
+
|
|
214
|
+
Keyword Args:
|
|
215
|
+
description (str):
|
|
216
|
+
Description of the category.
|
|
217
|
+
|
|
218
|
+
Returns:
|
|
219
|
+
:obj:`Box`: The newly configured custom TLD category resource record.
|
|
220
|
+
|
|
221
|
+
Examples:
|
|
222
|
+
Create a category for all 'developer' sites:
|
|
223
|
+
|
|
224
|
+
>>> zia.url_categories.add_tld_category(name='Developer Sites',
|
|
225
|
+
... urls=['.dev'],
|
|
226
|
+
... description="Sites that are likely run by developers.")
|
|
227
|
+
|
|
228
|
+
"""
|
|
229
|
+
|
|
230
|
+
payload = {
|
|
231
|
+
"type": "TLD_CATEGORY",
|
|
232
|
+
"superCategory": "USER_DEFINED", # TLDs can only be added in USER_DEFINED category
|
|
233
|
+
"configuredName": name,
|
|
234
|
+
"urls": tlds, # ZIA API reuses the 'urls' key for tlds
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
# Add optional parameters to payload
|
|
238
|
+
for key, value in kwargs.items():
|
|
239
|
+
payload[snake_to_camel(key)] = value
|
|
240
|
+
|
|
241
|
+
response = self.rest.post("urlCategories", json=payload)
|
|
242
|
+
if isinstance(response, Response):
|
|
243
|
+
# Handle error response
|
|
244
|
+
status_code = response.status_code
|
|
245
|
+
if status_code != 200:
|
|
246
|
+
raise Exception(
|
|
247
|
+
f"API call failed with status {status_code}: {response.json()}"
|
|
248
|
+
)
|
|
249
|
+
return response
|
|
250
|
+
|
|
251
|
+
def update_url_category(self, category_id: str, **kwargs) -> Box:
|
|
252
|
+
"""
|
|
253
|
+
Updates a URL category.
|
|
254
|
+
|
|
255
|
+
Args:
|
|
256
|
+
category_id (str):
|
|
257
|
+
The unique identifier of the URL category.
|
|
258
|
+
**kwargs:
|
|
259
|
+
Optional keyword args.
|
|
260
|
+
|
|
261
|
+
Keyword Args:
|
|
262
|
+
name (str):
|
|
263
|
+
The name of the URL category.
|
|
264
|
+
urls (list):
|
|
265
|
+
Custom URLs to add to a URL category.
|
|
266
|
+
db_categorized_urls (list):
|
|
267
|
+
URLs entered will be covered by policies that reference the parent category, in addition to this one.
|
|
268
|
+
description (str):
|
|
269
|
+
Description of the category.
|
|
270
|
+
ip_ranges (list):
|
|
271
|
+
Custom IP addpress ranges associated to a URL category. This feature must be enabled on your tenancy.
|
|
272
|
+
ip_ranges_retaining_parent_category (list):
|
|
273
|
+
The retaining parent custom IP addess ranges associated to a URL category.
|
|
274
|
+
keywords (list):
|
|
275
|
+
Custom keywords associated to a URL category.
|
|
276
|
+
keywords_retaining_parent_category (list):
|
|
277
|
+
Retained custom keywords from the parent URL category that are associated with a URL category.
|
|
278
|
+
|
|
279
|
+
Returns:
|
|
280
|
+
:obj:`Box`: The updated URL category resource record.
|
|
281
|
+
|
|
282
|
+
Examples:
|
|
283
|
+
Update the name of a category:
|
|
284
|
+
|
|
285
|
+
>>> zia.url_categories.update_url_category('CUSTOM_01',
|
|
286
|
+
... name="Wines that don't taste good.")
|
|
287
|
+
|
|
288
|
+
Update the urls of a category:
|
|
289
|
+
|
|
290
|
+
>>> zia.url_categories.update_url_category('CUSTOM_01',
|
|
291
|
+
... urls=['www.yellowtailwine.com'])
|
|
292
|
+
|
|
293
|
+
"""
|
|
294
|
+
|
|
295
|
+
payload = convert_keys(self.get_category(category_id))
|
|
296
|
+
|
|
297
|
+
# Add optional parameters to payload
|
|
298
|
+
for key, value in kwargs.items():
|
|
299
|
+
payload[snake_to_camel(key)] = value
|
|
300
|
+
|
|
301
|
+
response = self.rest.put(f"urlCategories/{category_id}", json=payload)
|
|
302
|
+
if isinstance(response, Response) and not response.ok:
|
|
303
|
+
# Handle error response
|
|
304
|
+
raise Exception(
|
|
305
|
+
f"API call failed with status {response.status_code}: {response.json()}"
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
# Return the updated object
|
|
309
|
+
return self.get_category(category_id)
|
|
310
|
+
|
|
311
|
+
def add_urls_to_category(self, category_id: str, urls: list) -> Box:
|
|
312
|
+
"""
|
|
313
|
+
Adds URLS to a URL category.
|
|
314
|
+
|
|
315
|
+
Args:
|
|
316
|
+
category_id (str):
|
|
317
|
+
The unique identifier of the URL category.
|
|
318
|
+
urls (list):
|
|
319
|
+
Custom URLs to add to a URL category.
|
|
320
|
+
|
|
321
|
+
Returns:
|
|
322
|
+
:obj:`Box`: The updated URL category resource record.
|
|
323
|
+
|
|
324
|
+
Examples:
|
|
325
|
+
>>> zia.url_categories.add_urls_to_category('CUSTOM_01',
|
|
326
|
+
... urls=['example.com'])
|
|
327
|
+
|
|
328
|
+
"""
|
|
329
|
+
|
|
330
|
+
payload = convert_keys(self.get_category(category_id))
|
|
331
|
+
payload["urls"] = urls
|
|
332
|
+
|
|
333
|
+
response = self.rest.put(
|
|
334
|
+
f"urlCategories/{category_id}?action=ADD_TO_LIST", json=payload
|
|
335
|
+
)
|
|
336
|
+
if isinstance(response, Response) and not response.ok:
|
|
337
|
+
# Handle error response
|
|
338
|
+
raise Exception(
|
|
339
|
+
f"API call failed with status {response.status_code}: {response.json()}"
|
|
340
|
+
)
|
|
341
|
+
|
|
342
|
+
def delete_urls_from_category(self, category_id: str, urls: list) -> Box:
|
|
343
|
+
"""
|
|
344
|
+
Deletes URLS from a URL category.
|
|
345
|
+
|
|
346
|
+
Args:
|
|
347
|
+
category_id (str):
|
|
348
|
+
The unique identifier of the URL category.
|
|
349
|
+
urls (list):
|
|
350
|
+
Custom URLs to delete from a URL category.
|
|
351
|
+
|
|
352
|
+
Returns:
|
|
353
|
+
:obj:`Box`: The updated URL category resource record.
|
|
354
|
+
|
|
355
|
+
Examples:
|
|
356
|
+
>>> zia.url_categories.delete_urls_from_category('CUSTOM_01',
|
|
357
|
+
... urls=['example.com'])
|
|
358
|
+
|
|
359
|
+
"""
|
|
360
|
+
current_config = self.get_category(category_id)
|
|
361
|
+
payload = {
|
|
362
|
+
"configuredName": current_config["configured_name"],
|
|
363
|
+
"urls": urls,
|
|
364
|
+
} # Required for successful call
|
|
365
|
+
|
|
366
|
+
return self.rest.put(
|
|
367
|
+
f"urlCategories/{category_id}?action=REMOVE_FROM_LIST", json=payload
|
|
368
|
+
)
|
|
369
|
+
|
|
370
|
+
def delete_from_category(self, category_id: str, **kwargs):
|
|
371
|
+
"""
|
|
372
|
+
Deletes the specified items from a URL category.
|
|
373
|
+
|
|
374
|
+
Args:
|
|
375
|
+
category_id (str):
|
|
376
|
+
The unique id for the URL category.
|
|
377
|
+
**kwargs:
|
|
378
|
+
Optional parameters.
|
|
379
|
+
|
|
380
|
+
Keyword Args:
|
|
381
|
+
keywords (list):
|
|
382
|
+
A list of keywords that will be deleted.
|
|
383
|
+
keywords_retaining_parent_category (list):
|
|
384
|
+
A list of keywords retaining their parent category that will be deleted.
|
|
385
|
+
urls (list):
|
|
386
|
+
A list of URLs that will be deleted.
|
|
387
|
+
db_categorized_urls (list):
|
|
388
|
+
A list of URLs retaining their parent category that will be deleted
|
|
389
|
+
|
|
390
|
+
Returns:
|
|
391
|
+
:obj:`Box`: The updated URL category resource record.
|
|
392
|
+
|
|
393
|
+
Examples:
|
|
394
|
+
Delete URLs retaining parent category from a custom category:
|
|
395
|
+
|
|
396
|
+
>>> zia.url_categories.delete_from_category(
|
|
397
|
+
... category_id="CUSTOM_01",
|
|
398
|
+
... db_categorized_urls=['twitter.com'])
|
|
399
|
+
|
|
400
|
+
Delete URLs and URLs retaining parent category from a custom category:
|
|
401
|
+
|
|
402
|
+
>>> zia.url_categories.delete_from_category(
|
|
403
|
+
... category_id="CUSTOM_01",
|
|
404
|
+
... urls=['news.com', 'cnn.com'],
|
|
405
|
+
... db_categorized_urls=['google.com, bing.com'])
|
|
406
|
+
|
|
407
|
+
"""
|
|
408
|
+
current_config = self.get_category(category_id)
|
|
409
|
+
|
|
410
|
+
payload = {
|
|
411
|
+
"configured_name": current_config[
|
|
412
|
+
"configured_name"
|
|
413
|
+
], # Required for successful call
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
# Add optional parameters to payload
|
|
417
|
+
for key, value in kwargs.items():
|
|
418
|
+
payload[key] = value
|
|
419
|
+
|
|
420
|
+
# Convert snake to camelcase
|
|
421
|
+
payload = convert_keys(payload)
|
|
422
|
+
|
|
423
|
+
return self.rest.put(
|
|
424
|
+
f"urlCategories/{category_id}?action=REMOVE_FROM_LIST", json=payload
|
|
425
|
+
)
|
|
426
|
+
|
|
427
|
+
def delete_category(self, category_id: str) -> int:
|
|
428
|
+
"""
|
|
429
|
+
Deletes the specified URL category.
|
|
430
|
+
|
|
431
|
+
Args:
|
|
432
|
+
category_id (str):
|
|
433
|
+
The unique identifier for the category.
|
|
434
|
+
|
|
435
|
+
Returns:
|
|
436
|
+
:obj:`int`: The status code for the operation.
|
|
437
|
+
|
|
438
|
+
Examples:
|
|
439
|
+
>>> zia.url_categories.delete_category('CUSTOM_01')
|
|
440
|
+
|
|
441
|
+
"""
|
|
442
|
+
return self.rest.delete(f"urlCategories/{category_id}").status_code
|