Skip to content

Commit

Permalink
fix: resolves #143, attribute error with missing blacklistUrls attrib…
Browse files Browse the repository at this point in the history
…ute in JSON response

refactor: alters method to return blacklist URLs after adding a URL using existing GET method
  • Loading branch information
mitchos committed Oct 17, 2022
1 parent dc07674 commit 7db9706
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pyzscaler/zia/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_blacklist(self) -> BoxList:
"""

return self._get("security/advanced").blacklistUrls
return self._get("security/advanced").blacklist_urls

def erase_whitelist(self) -> int:
"""
Expand Down Expand Up @@ -142,7 +142,11 @@ def add_urls_to_blacklist(self, url_list: list) -> BoxList:

payload = {"blacklistUrls": url_list}

return self._post("security/advanced/blacklistUrls?action=ADD_TO_LIST", json=payload).blacklist_urls
resp = self._post("security/advanced/blacklistUrls?action=ADD_TO_LIST", json=payload).status_code

# Return the object if it was updated successfully
if resp == 204:
return self.get_blacklist()

def replace_blacklist(self, url_list: list) -> BoxList:
"""
Expand Down

0 comments on commit 7db9706

Please sign in to comment.