mitchos/pyZscaler

[BUG] zia.url_categories.delete_urls_from_category will empty urls in "URLs Retaining Parent Category"

Closed this issue · 3 comments

v 1.4
Tested in:
zscaler
zscalerbeta

Code:
with ZIA(api_key=api_key, cloud=cloud, username=username, password=password) as zia:
end = 0
out = []
#100 record per call limit
while end <= len(Qurl()):
start = end
end=end+100
print("POSITION:%s:%s" % (start,end))
result = zia.url_categories.delete_urls_from_category('CUSTOM_30',urls=Qurl()[start:end])
out.append(result)
else:
print("POSITION:%s:%s" % (5900,5921))
result = zia.url_categories.delete_urls_from_category('CUSTOM_30', urls=Qurl()[5900:5921])
out.append(result)

URL in "Custom URLs" reserved.

Hi @shuangqingliCN thanks for lodging this bug.

I'll take a look at this tonight to try and replicate first and then look at what we need to do to get a fix in place. Seeing as this is breaking functionality as far as I'm concerned, you can expect a fix release as soon as it's resolved.

@shuangqingliCN I was able to replicate this successfully and I've fixed this issue in the zia.url_categories.delete_urls_from_category() method.

I've also implemented a new endpoint zia.url_categories.delete_from_category() that allows you to specify any combination of the following for removal:

  • keywords
  • keywords retaining parent category
  • urls
  • urls retaining parent category

I think you'll find this a more flexible solution going forward so I'll likely look to deprecate the delete_urls_from_category() method.

This is already in the develop branch, so you're welcome to pull that branch directly to test but I have two other bugs that are quick fixes that I want to slot into the next release so I'll push this fix back with them. I should have it out in 2-3 days.

Got it , thanks for fixing this.