You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* add_attached_images
* WIP update save attached_image with option to async save
WIP: for some reason when utilizing threading, logged in client does not persist among threads. added a client parameter to post to /attached_media route and private _save_attached_image so logged in client can bubble down..
ideally, this would be saved in threading.local()
* add metadata as param to ancillary data upload
* remove pdb trace
* return future object to bubble up thread exceptions
* update mimetype detection using newer logic from master
* add media type validation to upload subject attacned images
* fix detect mime type typo
* update upload ancillary data to return Future . Caller will need to call .result() to see if successful/errors
* hound indentation sniffs
* add doc strings to newly added methods
* Update panoptes_client/subject.py
Co-authored-by: Cliff Johnson <cliff@zooniverse.org>
* Update panoptes_client/subject.py
Co-authored-by: Cliff Johnson <cliff@zooniverse.org>
* Update panoptes_client/subject.py
Co-authored-by: Cliff Johnson <cliff@zooniverse.org>
* Update panoptes_client/subject.py
Co-authored-by: Cliff Johnson <cliff@zooniverse.org>
* check subject existence on new attached_images methods, make add_attached_image a private method since used internally, add eg. on saved attached image for externally hosted files
* add comments on examples in doc strings
* update content type on private method to keyword arg (updating calls to changed method to match order)
---------
Co-authored-by: Cliff Johnson <cliff@zooniverse.org>
NOTE: This should NOT be confused with subject location.
395
+
A subject location is the content of the subject that a volunteer will classify.
396
+
A subject attached_media is ancillary data associated to the subject that get displayed on the Subject's Talk Page.
397
+
398
+
- **attached_media** can be an open :py:class:`file` object, a path to a
399
+
local file, or a :py:class:`dict` containing MIME types and URLs for
400
+
remote media.
401
+
- **manual_mimetype** optional string, passes in a specific MIME type for media item.
402
+
- **metadata** can be a :py:class:`dict` that stores additional info on attached_media.
403
+
- **client** optional Panoptes.client() instance. Sent as a parameter for threading purposes for parallelization so that thread uses the correct client context.
404
+
405
+
Examples::
406
+
407
+
# Upload image by sending in a :py:class:`file` object
408
+
subject.save_attached_image(my_file)
409
+
# Upload local image by passing path to file
410
+
subject.save_attached_image('/data/image.jpg')
411
+
# Upload local image and set mimetype and record's metadata
0 commit comments