-
Notifications
You must be signed in to change notification settings - Fork 451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SENTINEL-INTEL] fix: add explicit error when authentication fails #3396
[SENTINEL-INTEL] fix: add explicit error when authentication fails #3396
Conversation
@@ -38,6 +38,7 @@ def _get_authorization_header(self): | |||
""" | |||
Get an OAuth access token and set it as Authorization header in headers. | |||
""" | |||
response_json = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Init to be able to try to get content for error log
@@ -48,16 +49,23 @@ def _get_authorization_header(self): | |||
} | |||
response = requests.post(url, data=body) | |||
response_json = response.json() | |||
response.raise_for_status() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
core of the PR
|
||
except Exception as e: | ||
raise ValueError("[ERROR] Failed generating oauth token {" + str(e) + "}") | ||
except (requests.exceptions.HTTPError, KeyError) as e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
core of the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks you @flavienSindou for adding this
Everything looks good to me :)
Proposed changes
Related issues
Checklist
Further comments
Notion investigation page https://www.notion.so/filigran/Sentinel-Intel-Connector-Not-Sending-Data-18b8fce17f2a80369730d92656219234