Skip to content

Commit

Permalink
feat(url analysis): Add invalid url error TKT-1270
Browse files Browse the repository at this point in the history
  • Loading branch information
yoniabrahamy committed Oct 23, 2023
1 parent 9fef251 commit a34d6fb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion intezer_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.19.5'
__version__ = '1.19.6'
3 changes: 3 additions & 0 deletions intezer_sdk/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,9 @@ def _assert_analysis_response_status_code(response: Response):
if result.get('is_url_offline'):
raise errors.UrlOfflineError(response)

if error == 'Invalid url':
raise errors.InvalidUrlError(response)

raise errors.ServerError(f'Server returned bad request error: {error}', response)
elif response.status_code != HTTPStatus.CREATED:
raise errors.ServerError(f'Error in response status code:{response.status_code}', response)
Expand Down
9 changes: 9 additions & 0 deletions intezer_sdk/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ class HashDoesNotExistError(ServerError):
def __init__(self, response: requests.Response):
super().__init__('Hash was not found', response)


class FileTooLargeError(ServerError):
def __init__(self, response: requests.Response):
super().__init__('File is too large', response)


class ReportDoesNotExistError(IntezerError):
def __init__(self):
super().__init__('Report was not found')
Expand Down Expand Up @@ -156,10 +158,17 @@ class AlertNotFoundError(AlertError):
def __init__(self, alert_id: str):
super().__init__(f'The given alert does not exist - {alert_id}')


class InvalidAlertArgumentError(AlertError):
def __init__(self, message: str):
super().__init__(message)


class UrlOfflineError(ServerError):
def __init__(self, response: requests.Response):
super().__init__('Url is offline', response)


class InvalidUrlError(ServerError):
def __init__(self, response: requests.Response):
super().__init__('Invalid url', response)

0 comments on commit a34d6fb

Please sign in to comment.