Skip to content

Commit

Permalink
PAPP-34426 fix pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kzuchowska-splunk committed Jan 9, 2025
1 parent 995cc57 commit 776d838
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions wildfire_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ def _save_file_to_vault(self, action_result, response, sample_hash):
# open and download the file
try:
with open(file_path, "wb") as f:
if not isinstance(response, str): # handle empty files
if not isinstance(response, str): # handle empty files
f.write(response.content)
except Exception as e:
error_message = self._get_error_message_from_exception(e)
Expand Down Expand Up @@ -657,18 +657,24 @@ def _save_file_to_vault(self, action_result, response, sample_hash):

return action_result.get_status()


def _get_sample(self, param):

action_result = self.add_action_result(ActionResult(dict(param)))

sample_hash = param[WILDFIRE_JSON_HASH]

self.save_progress('Getting file from WildFire')
self.save_progress("Getting file from WildFire")

# wildfire API returns 403 for empty file
ret_val, response = self._make_rest_call('/get/sample', action_result, self.GET_SAMPLE_ERROR_DESC,
method='post', data={'hash': sample_hash}, parse_response=False, additional_succ_codes={403:None})
ret_val, response = self._make_rest_call(
"/get/sample",
action_result,
self.GET_SAMPLE_ERROR_DESC,
method="post",
data={"hash": sample_hash},
parse_response=False,
additional_succ_codes={403: None},
)

if phantom.is_fail(ret_val):
return action_result.get_status()
Expand Down Expand Up @@ -723,10 +729,15 @@ def _get_pcap(self, param):

self.save_progress("Getting pcap from WildFire")


# wildfire API returns 403 for empty file
ret_val, response = self._make_rest_call(
"/get/pcap", action_result, self.GET_PCAP_ERROR_DESC, method="post", data=rest_data, parse_response=False, additional_succ_codes={403:None}
"/get/pcap",
action_result,
self.GET_PCAP_ERROR_DESC,
method="post",
data=rest_data,
parse_response=False,
additional_succ_codes={403: None},
)

if phantom.is_fail(ret_val):
Expand Down

0 comments on commit 776d838

Please sign in to comment.