Skip to content

Commit

Permalink
fix: fixes #160, resolves #162, resolves #165 let ZIA sandbox submiss…
Browse files Browse the repository at this point in the history
…ion inherit env_cloud
  • Loading branch information
mitchos committed Feb 20, 2023
1 parent e74bf07 commit 57402f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 3 additions & 4 deletions pyzscaler/zia/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,16 @@ class ZIA(APISession):
_box = True
_box_attrs = {"camel_killer_box": True}
_env_base = "ZIA"
_env_cloud = "zscaler"
_url = "https://zsapi.zscaler.net/api/v1"
env_cloud = "zscaler"

def __init__(self, **kw):
self._api_key = kw.get("api_key", os.getenv(f"{self._env_base}_API_KEY"))
self._username = kw.get("username", os.getenv(f"{self._env_base}_USERNAME"))
self._password = kw.get("password", os.getenv(f"{self._env_base}_PASSWORD"))
self._env_cloud = kw.get("cloud", os.getenv(f"{self._env_base}_CLOUD"))
self.env_cloud = kw.get("cloud", os.getenv(f"{self._env_base}_CLOUD"))
self._url = (
kw.get("override_url", os.getenv(f"{self._env_base}_OVERRIDE_URL"))
or f"https://zsapi.{self._env_cloud}.net/api/v1"
kw.get("override_url", os.getenv(f"{self._env_base}_OVERRIDE_URL")) or f"https://zsapi.{self.env_cloud}.net/api/v1"
)
self.conv_box = True
self.sandbox_token = kw.get("sandbox_token", os.getenv(f"{self._env_base}_SANDBOX_TOKEN"))
Expand Down
3 changes: 2 additions & 1 deletion pyzscaler/zia/sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def __init__(self, api: APISession):
super().__init__(api)

self.sandbox_token = api.sandbox_token
self.env_cloud = api.env_cloud

def submit_file(self, file: str, force: bool = False) -> Box:
"""
Expand All @@ -34,7 +35,7 @@ def submit_file(self, file: str, force: bool = False) -> Box:
"force": int(force), # convert boolean to int for ZIA
}

return self._post("https://csbapi.zscaler.net/zscsb/submit", params=params, data=data)
return self._post(f"https://csbapi.{self.env_cloud}.net/zscsb/submit", params=params, data=data)

def get_quota(self) -> Box:
"""
Expand Down

0 comments on commit 57402f9

Please sign in to comment.