Hello,
I want to report a bug related to adding attachments to a feature in an ArcGIS Enterprise Feature Service using the ArcGISAttachmentConnector in the latest version.
I receive the following error:
(C:\Users\x\AppData\Roaming\Safe Software\FME\Packages\25606-win64\python\safe.esri-agol\fmepy_esri_agol\attachments\handler.py:104) add_attachment
return AttachmentResult.from_dict(response.get("addAttachmentResult", {}))
^^^^^^^^^^^^
910523 Python Exception <AttributeError>: 'generator' object has no attribute 'get'
The problem is that the ArcGIS REST API addAttachment endpoint returns text/html instead of json. This appears to happen specifically for Enterprise Feature Services, as described here. As a result, the result cannot be decoded. However, the attachment is actually uploaded successfully.
Bug fix:
Change the line 43 from
files = {"attachment": (filename, file_obj, mime_type))}
to
files = {"attachment": (filename, file_obj, mime_type), "f": (None, "json")}
in C:\Users\x\AppData\Roaming\Safe Software\FME\Packages\25606-win64\python\safe.esri-agol\fmepy_esri_agol\attachments\api.py
I just tested addAttachment but it may also occur for updateAttachment.
Esri ArcGIS Connector: https://hub.safe.com/publishers/safe/packages/esri-agol/versions/3.9.5
FME(R) 2025.1.0.0 (20250704 - Build 25606 - WIN64)
ArcGIS Enterprise 11.5