Skip to content

AttachmentManager downlad() attachment_id parameter not honored; return_all argument not supported #2479

@knoopum

Description

@knoopum

Describe the bug
Under AttachmentManager, the documentation for download mentions a return_all argument in the description for the attachment_id argument, however, it is not supported.

Attempting to provide a list of Attachment IDs to attachment_id, while setting return_all=False, fails because return_all is not supported.

Leaving off the return_all argument also fails, as the list of provided for attachment_id is not honored, and it attempts to return all attachments.

return_all is also is mentioned in, but missing from, download's signature:

x.attachments.download(
    oid: 'str | None' = None,
    attachment_id: 'str | None' = None,
    save_path: 'str | None' = None,
)
Docstring:
Downloads attachment and returns its path on disk.

The download tool works as follows:

* If nothing is given, all attachments will be downloaded

  Example: download()

* If a single oid and attachment_id are given, the single file will download

* If a list of oid values are given, all the attachments for those object ids will be saved locally.

=========================   ===============================================================
**Argument**                **Description**
-------------------------   ---------------------------------------------------------------
oid                         Optional list/string. A list of object Ids or a single value
                            to download data from.
-------------------------   ---------------------------------------------------------------
attachment_id               Optional string. Id of the attachment to download. This is only
                            honored if return_all is False.
-------------------------   ---------------------------------------------------------------
save_path                   Optional string. Path to save data to.
=========================   ===============================================================

:return: A path to the folder where the attachement are saved

To Reproduce
Steps to reproduce the behavior:

attachment_path = x.attachments.download(
    attachment_id = attachment_id_list,
    save_path = layer_attachments_path,
    return_all = False
)

error:

TypeError: AttachmentManager.download() got an unexpected keyword argument 'return_all'

Expected behavior
I would like to be able to download a specific subset of attachments, specified by their Attachment IDs.

I want to use the Attachment's IDs, rather than their parent's IDs, as the parent features often have more than one attachment and I do not want to download them all. I only want a specific subset of attachments.

Platform (please complete the following information):

  • OS: Windows 64 and ArcGIS Online
  • Browser: Chrome
  • Python API Version: 2.4.2

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions