Skip to content
Open
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
29 changes: 29 additions & 0 deletions panoptes_client/subject.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,35 @@ def save_attached_image(
upload_exec.shutdown(wait=True)
return future_result

def delete_attached_image(
self,
attached_image_id
):
"""
Delete attached_media from the subject.
NOTE: This should NOT be confused with subject location.
A subject location is the content of the subject that a volunteer will classify.
A subject attached_media is ancillary data associated to the subject that get displayed on the Subject's Talk Page.

- **attached_image_id** ID of the subject atached_media you want to delete

Examples::
subject.delete_attached_image(123)
"""
try:
_, etag = self._get_attached_image(attached_image_id)
return self.http_delete('{}/attached_images/{}'.format(self.id, attached_image_id), etag=etag)
except PanoptesAPIException as err:
raise err

def _get_attached_image(
self,
attached_image_id
):
if self.id is None or attached_image_id is None:
raise ObjectNotSavedException
return self.http_get('{}/attached_images/{}'.format(self.id, attached_image_id))


class UnknownMediaException(Exception):
pass
Expand Down