From 8125ed7506690efe9d96b0283b1462006af962ac Mon Sep 17 00:00:00 2001 From: yuenmichelle1 Date: Tue, 6 Jan 2026 14:27:03 -0600 Subject: [PATCH 1/3] add delete_attached_image functionality --- panoptes_client/subject.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/panoptes_client/subject.py b/panoptes_client/subject.py index db15562..1fc0e1c 100644 --- a/panoptes_client/subject.py +++ b/panoptes_client/subject.py @@ -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 this 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 From 34daa9f57e95c4bd49e0fdfbabe7002e7b61c10e Mon Sep 17 00:00:00 2001 From: yuenmichelle1 Date: Tue, 6 Jan 2026 14:27:38 -0600 Subject: [PATCH 2/3] Update subject.py --- panoptes_client/subject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panoptes_client/subject.py b/panoptes_client/subject.py index 1fc0e1c..cb44441 100644 --- a/panoptes_client/subject.py +++ b/panoptes_client/subject.py @@ -472,7 +472,7 @@ def delete_attached_image( attached_image_id ): """ - Delete attached_media from this subject. + 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. From 081750dc23d43df56763fc3f811884d48e759b78 Mon Sep 17 00:00:00 2001 From: yuenmichelle1 Date: Tue, 6 Jan 2026 14:31:58 -0600 Subject: [PATCH 3/3] update spacing issue found on hound sniff --- panoptes_client/subject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panoptes_client/subject.py b/panoptes_client/subject.py index cb44441..dadf81b 100644 --- a/panoptes_client/subject.py +++ b/panoptes_client/subject.py @@ -484,7 +484,7 @@ def delete_attached_image( """ try: _, etag = self._get_attached_image(attached_image_id) - return self.http_delete('{}/attached_images/{}'.format(self.id, attached_image_id), etag = etag) + return self.http_delete('{}/attached_images/{}'.format(self.id, attached_image_id), etag=etag) except PanoptesAPIException as err: raise err