diff --git a/Packs/Zscaler/Integrations/Zscaler/Zscaler.py b/Packs/Zscaler/Integrations/Zscaler/Zscaler.py index 79b34b4b7201..d0356f526d66 100644 --- a/Packs/Zscaler/Integrations/Zscaler/Zscaler.py +++ b/Packs/Zscaler/Integrations/Zscaler/Zscaler.py @@ -1,10 +1,6 @@ -import urllib3 - import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 -# disable insecure warnings -urllib3.disable_warnings() """ GLOBAL VARS """ ADD = "ADD_TO_LIST" @@ -24,8 +20,6 @@ PROXY = demisto.params().get("proxy", True) REQUEST_TIMEOUT = int(demisto.params().get("requestTimeout", 15)) DEFAULT_HEADERS = {"content-type": "application/json"} -EXCEEDED_RATE_LIMIT_STATUS_CODE = 429 -MAX_SECONDS_TO_WAIT = 100 SESSION_ID_KEY = "session_id" ERROR_CODES_DICT = { 400: "Invalid or bad request", @@ -78,7 +72,7 @@ class AuthorizationError(DemistoException): def error_handler(res): """ - Deals with unsuccessfull calls + Deals with unsuccessful calls """ if res.status_code in (401, 403): raise AuthorizationError(res.content) @@ -94,23 +88,24 @@ def error_handler(res): else: if res.status_code in ERROR_CODES_DICT: raise Exception( - "Your request failed with the following error: {}.\nMessage: {}".format( - ERROR_CODES_DICT[res.status_code], res.text - ) + f"The request failed with the following error: {ERROR_CODES_DICT[res.status_code]}.\nMessage: {res.text}" ) else: raise Exception( - "Your request failed with the following error: {}.\nMessage: {}".format( - res.status_code, res.text - ) + f"The request failed with the following error: {res.status_code}.\nMessage: {res.text}" ) def http_request(method, url_suffix, data=None, headers=None, resp_type='json'): + time_sensitive = is_time_sensitive() + demisto.debug(f'{time_sensitive=}') + retries = 0 if time_sensitive else 3 + status_list_to_retry = None if time_sensitive else [429] + timeout = 2 if time_sensitive else REQUEST_TIMEOUT try: res = generic_http_request(method=method, server_url=BASE_URL, - timeout=REQUEST_TIMEOUT, + timeout=timeout, verify=USE_SSL, proxy=PROXY, client_headers=DEFAULT_HEADERS, @@ -119,8 +114,8 @@ def http_request(method, url_suffix, data=None, headers=None, resp_type='json'): data=data or {}, ok_codes=(200, 204), error_handler=error_handler, - retries=3, - status_list_to_retry=[429], + retries=retries, + status_list_to_retry=status_list_to_retry, resp_type=resp_type) except Exception as e: diff --git a/Packs/Zscaler/ReleaseNotes/1_3_20.md b/Packs/Zscaler/ReleaseNotes/1_3_20.md new file mode 100644 index 000000000000..d6545857b396 --- /dev/null +++ b/Packs/Zscaler/ReleaseNotes/1_3_20.md @@ -0,0 +1,6 @@ + +#### Integrations + +##### Zscaler Internet Access + +Updated the ***ip*** and ***url*** commands to not retry, and decreased the timeout, when used for auto-enrichment and called with `auto-extract=inline`. diff --git a/Packs/Zscaler/pack_metadata.json b/Packs/Zscaler/pack_metadata.json index e84d9483bd16..f9457d6fc31e 100644 --- a/Packs/Zscaler/pack_metadata.json +++ b/Packs/Zscaler/pack_metadata.json @@ -2,7 +2,7 @@ "name": "Zscaler Internet Access", "description": "Zscaler is a cloud security solution built for performance and flexible scalability.", "support": "xsoar", - "currentVersion": "1.3.19", + "currentVersion": "1.3.20", "author": "Cortex XSOAR", "url": "https://www.paloaltonetworks.com/cortex", "email": "",