Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
shuangqingliCN opened this issue Feb 15, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@shuangqingliCN
Copy link

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.

@shuangqingliCN shuangqingliCN added the bug Something isn't working label Feb 15, 2023
@mitchos
Copy link
Owner

mitchos commented Feb 16, 2023

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.

@mitchos
Copy link
Owner

mitchos commented Feb 16, 2023

@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.

@mitchos mitchos changed the title zia.url_categories.delete_urls_from_category will empty urls in "URLs Retaining Parent Category" [BUG] zia.url_categories.delete_urls_from_category will empty urls in "URLs Retaining Parent Category" Feb 20, 2023
@shuangqingliCN
Copy link
Author

Got it , thanks for fixing this.

mitchos added a commit that referenced this issue Apr 3, 2023
… custom category fields

feat: implements a new ZIA URL category method that allows selective deletion of URLs and keywords
test: updates test suite and adds new test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants