Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions splunklib/binding.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ def connect(self):

@_authentication
@_log_duration
def delete(self, path_segment, owner=None, app=None, sharing=None, **query):
def delete(self, path_segment, owner=None, app=None, headers=None, sharing=None, **query):
"""Performs a DELETE operation at the REST path segment with the given
namespace and query.

Expand All @@ -589,6 +589,8 @@ def delete(self, path_segment, owner=None, app=None, sharing=None, **query):
:type owner: ``string``
:param app: The app context of the namespace (optional).
:type app: ``string``
:param headers: List of extra HTTP headers to send (optional).
:type headers: ``list`` of 2-tuples.
:param sharing: The sharing mode of the namespace (optional).
:type sharing: ``string``
:param query: All other keyword arguments, which are used as query
Expand Down Expand Up @@ -616,10 +618,15 @@ def delete(self, path_segment, owner=None, app=None, sharing=None, **query):
c.logout()
c.delete('apps/local') # raises AuthenticationError
"""

if headers is None:
headers = []

path = self.authority + self._abspath(path_segment, owner=owner,
app=app, sharing=sharing)
logging.debug("DELETE request to %s (body: %s)", path, repr(query))
response = self.http.delete(path, self._auth_headers, **query)
all_headers = headers + self.additional_headers + self._auth_headers
response = self.http.delete(path, all_headers, **query)
return response

@_authentication
Expand Down