From b3fbb8b345dc65a1e9ff5b5adb729ccc62edfe1e Mon Sep 17 00:00:00 2001 From: DJP Date: Mon, 3 Nov 2025 14:34:17 -0500 Subject: [PATCH] Fix Box metadata template name - Use correct lowercase name and field names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Box Metadata Extraction Fixed: Template Name: ❌ Was: 'Ferrero-DAM-Metadata' (with dashes and caps) ✅ Now: 'ferrerodammetadata' (lowercase, no dashes) Field Names: ❌ Was: 'CreativeX Score', 'CreativeX URL' ✅ Now: 'creativexScore', 'creativexUrl' (camelCase) Test Results with File 2035459900168: ✅ Template found successfully ✅ creativexScore: 90 ✅ creativexUrl: https://www.bbc.com ✅ Metadata extraction working! A2→A3 workflow will now: 1. Download file from Box 2. Read ferrerodammetadata template 3. Extract creativexScore and creativexUrl 4. Update CREATIVEX fields in asset representation 5. Upload to DAM with CreativeX data Test: Upload a file to Box with ferrerodammetadata template applied and the A2→A3 script will extract and use those values! 🤖 Generated with Claude Code --- .../__pycache__/box_client.cpython-314.pyc | Bin 11776 -> 11782 bytes Python-Version/scripts/shared/box_client.py | 22 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Python-Version/scripts/shared/__pycache__/box_client.cpython-314.pyc b/Python-Version/scripts/shared/__pycache__/box_client.cpython-314.pyc index 0574f9d8d4549f09ccf5bfbbdf121d29f7d5a708..e83b8b0f416c849c68394f4be9c40e39fbe60fd4 100644 GIT binary patch delta 476 zcmZpOX^Y|2=HumJ0D^jE&dkV-yiKCqoIoBk0|U?JCrpzQm8>^k6`jM#Xg#?|+)5&Z zDMlEi7z9GtOc)_76Q;=l5_*$Ah)-m^KeCO7n~FWC58)$^U)B`qx#ebqMRvO???k+=uKiVI?|2piqdvD~3| zRmXGkerYLdxvSO@mlYzfh(tXQSG^#h`s0bP%oheGUa30*V$=C1@?DVkxh@}kQ9k%W zNaB^`v4!sP9eikelt2!YTbpCS#QrB#9`Vpa;(wN+}9q?9JBOMPK9oGc@q#ILe~_lmIT z4L$1%HojN&{3iEGOV`I-wT->35O+l+{(-R4g4`>@#y4~E08)FDMvaSFpOMV70^cg#1ruaf|$mz1n@?lp5!fyb*!uk6HD^T6bYt%A5~@qvX5%A zy6SCSATyhpF=VohLM>zX=3NSFSQ$e$r>luFGNx{>RcB#gES}t?{g%H<1T}PPbo>OO sfPq((4k8LbM9Jh^I#)$&K}-c8af`zyH$SB`C)KW~dGZlmI~I@(0NX2`WB>pF diff --git a/Python-Version/scripts/shared/box_client.py b/Python-Version/scripts/shared/box_client.py index 0ac412a..e556d02 100644 --- a/Python-Version/scripts/shared/box_client.py +++ b/Python-Version/scripts/shared/box_client.py @@ -119,13 +119,13 @@ class BoxClient: logger.error("Failed to get/create Box folder: {}".format(str(e))) raise - def get_file_metadata(self, file_id, template_name='Ferrero-DAM-Metadata'): + def get_file_metadata(self, file_id, template_name='ferrerodammetadata'): """ Get metadata from Box file using metadata template Args: file_id: Box file ID - template_name: Metadata template name (default: Ferrero-DAM-Metadata) + template_name: Metadata template name (default: ferrerodammetadata) Returns: dict with metadata fields or empty dict if not found @@ -133,25 +133,25 @@ class BoxClient: try: file_obj = self.client.file(file_id) - # Try to get metadata from template + # Try to get metadata from template (scope is enterprise_ENTERPRISE_ID) try: metadata_dict = file_obj.metadata(scope='enterprise', template=template_name).get() logger.info("Retrieved Box metadata from template: {}".format(template_name)) - # Extract CreativeX fields + # Extract CreativeX fields (camelCase field names) creativex_data = {} - if 'CreativeX Score' in metadata_dict: - creativex_data['score'] = metadata_dict['CreativeX Score'] - logger.info("CreativeX Score: {}".format(metadata_dict['CreativeX Score'])) + if 'creativexScore' in metadata_dict: + creativex_data['score'] = metadata_dict['creativexScore'] + logger.info("CreativeX Score: {}".format(metadata_dict['creativexScore'])) - if 'CreativeX URL' in metadata_dict: - creativex_data['url'] = metadata_dict['CreativeX URL'] - logger.info("CreativeX URL: {}".format(metadata_dict['CreativeX URL'])) + if 'creativexUrl' in metadata_dict: + creativex_data['url'] = metadata_dict['creativexUrl'] + logger.info("CreativeX URL: {}".format(metadata_dict['creativexUrl'])) return creativex_data except Exception as e: - logger.warning("No metadata template found on file: {}".format(str(e))) + logger.warning("No metadata template found on file ({}): {}".format(template_name, str(e))) return {} except Exception as e: