From 38998a95a5e6b15501127383dcbb14c071137b98 Mon Sep 17 00:00:00 2001 From: Andrew Woodford <andrew.woodford@darktrace.com> Date: Fri, 7 Sep 2018 11:24:56 +0100 Subject: [PATCH] Bug fixes - delete method in AuditReport was using the job endpoint rather than report endpoint and therefore failing. Additionally, when an audit report is successfully deleted it returns a 204 status (i.e. no content) and the check_response function fails if the status is not 200 so also added no content as a valid HTTP response. --- egnyte/audits.py | 4 ++++ egnyte/exc.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/egnyte/audits.py b/egnyte/audits.py index fb566da..560b663 100644 --- a/egnyte/audits.py +++ b/egnyte/audits.py @@ -128,3 +128,7 @@ def download(self): def json(self): r = self._client.GET(self.complete_url()) return exc.default.check_json_response(r) + + def delete(self): + r = self._client.DELETE(self.complete_url()) + exc.default.check_response(r) diff --git a/egnyte/exc.py b/egnyte/exc.py index 798bbf2..8117711 100644 --- a/egnyte/exc.py +++ b/egnyte/exc.py @@ -127,7 +127,7 @@ class ErrorMapping(dict): """Maps HTTP status to EgnyteError subclasses""" ignored_errors = () - def __init__(self, values=None, ok_statuses=(http_client.OK, ), ignored_errors=None): + def __init__(self, values=None, ok_statuses=(http_client.OK, http_client.NO_CONTENT), ignored_errors=None): super(ErrorMapping, self).__init__({ http_client.BAD_REQUEST: RequestError, http_client.UNAUTHORIZED: NotAuthorized,