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 0574f9d..e83b8b0 100644 Binary files a/Python-Version/scripts/shared/__pycache__/box_client.cpython-314.pyc and b/Python-Version/scripts/shared/__pycache__/box_client.cpython-314.pyc differ 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: