ibmresilient / resilient-community-apps

Source code for IBM SOAR Apps that are available on our App Exchange
https://ibm.biz/soar-apps-docs
MIT License
88 stars 96 forks source link

CommonRequests should not raise an error when request response is 404 : ressource not found... #80

Closed Heyji2 closed 2 years ago

Heyji2 commented 2 years ago

Description

I am using the Utilities: Call Rest API function in a worklow. The workflow crashes with the following error message:

File "/usr/local/lib/python3.6/site-packages/resilient_lib/components/requests_common.py", line 138, in execute_call_v2 raise IntegrationError(msg) resilient_lib.components.integration_errors.IntegrationError: '404 Client Error: Processed for url: https://url_modified_in_public_forum:8843/ressource1/ressource2'

This is because of the line 142 and 143 in request_common.py :

# Raise error is bad status code is returned
response.raise_for_status()

I believe an 404 Client error (HTTP 404 : ressource not found) should not raise an error in this function. This is not an integration error, this is just the client trying to fetch a ressource that does not exists. The client could handle this error code itself, rather than stopping the workflow. I believe this line should be removed.

Describe How to Reproduce

to reproduce this error, just fetch an non existing ressource, and see the workflow stoping with en error. Instead, I would have the workflow continue and return the response (which indicates a 404 Error).

Heyji2 commented 2 years ago

I move this issue to resilient-python-api as this is where the source code in question lies.