{"id":27620920,"url":"https://github.com/ashokkumarta/dampy","last_synced_at":"2025-04-23T07:33:12.417Z","repository":{"id":62566387,"uuid":"188251691","full_name":"ashokkumarta/dampy","owner":"ashokkumarta","description":"DamPy is a command line tool + Python library to work with Adobe Experience Manager (AEM) Assets (DAM). It provides a comprehensive API to perform all operations on assets and is intended to provide a full command line interface for working with AEM DAM.","archived":false,"fork":false,"pushed_at":"2020-12-23T14:16:08.000Z","size":22741,"stargazers_count":10,"open_issues_count":6,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-16T13:06:04.336Z","etag":null,"topics":["adobe","aem","assets","cli","command","dam","experiance","library","line","manager","python","python3","script","tool","utility"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/dampy/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ashokkumarta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-23T14:36:26.000Z","updated_at":"2024-07-01T17:30:10.000Z","dependencies_parsed_at":"2022-11-03T17:47:50.864Z","dependency_job_id":null,"html_url":"https://github.com/ashokkumarta/dampy","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashokkumarta%2Fdampy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashokkumarta%2Fdampy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashokkumarta%2Fdampy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashokkumarta%2Fdampy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ashokkumarta","download_url":"https://codeload.github.com/ashokkumarta/dampy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250392496,"owners_count":21423080,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adobe","aem","assets","cli","command","dam","experiance","library","line","manager","python","python3","script","tool","utility"],"created_at":"2025-04-23T07:33:11.759Z","updated_at":"2025-04-23T07:33:12.400Z","avatar_url":"https://github.com/ashokkumarta.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n![](dampy-logo.png)\n\n*A command line interface for **Adobe Experience Manager (AEM) - DAM***\n\n\u003chr/\u003e\n\n**DamPy** is essentially a command line tool for working with Adobe Experience Manager (AEM) Digital Assets (DAM). Its purpose if two fold:\n* To provide a command line interface to access all DAM functionalities\n* To provide a comprehensive Python API to perform all operations on assets in AEM\n\n## Dependencies\n```\nPython 3\n```\n\n## Features\n* Find a list of all assets in DAM / under a folder\n* Create a new folder\n* Move folder to a different path\n* Modify the folder title \n* Create a complete folder tree structure\n* Get the folder tree structure of DAM / under specific path\n* Restructure the folder hierarchy in DAM\n* Upload a new asset\n* Upload a local folder with all its assets and subfolders to DAM\n* Download an asset from DAM\n* Download a complete folder from DAM\n* Get the metadata of assets\n* Extract specified properties of the assets to a CSV file\n* Update properties of assets based on CSV file\n* Activate an asset or a folder\n* Activate a given list of assets and folders\n* Deactivate an asset or a folder\n* Deactivate a given list of assets and folders\n* Delete an asset or a folder\n* Delete a given list of assets and folders\n* Check if an asset already exists in DAM and the path(s) at which its present\n* Report all duplicate assets in DAM / under a path \n* Check-out and Check-in an asset in DAM / under a path \n* Edit an asset in DAM / under a path (crop, rotate, flip, map)\n\n\n## About the tool\n**DamPy** is a tool to work with AEM DAM. For a client I recently work with, as we went live the client team had frequent requests to\n* Get a list of all the assets under a path \n* Download all assets under a path\n* Upload assets organized in the local folder structure to DAM\n* Extract specific properties of all assets under a path\n* Update properties of assets based on spreadsheet\n* And so on…\n\nAfter dabbling with curls, AEM reports and WebDAV tools, I came to realize that writing Python scripts to make REST API calls to AEM and/or convert the result JSON into required output format to be the quickest and easiest option to handle these requests. \n\n**DamPy** is a consolidation of many such scripts written into a comprehensive tool to work with AEM DAM \n\n\n## Getting Started\n**DamPy** is available as pip install. To start working on this tool install it through pip command\n\n```\npip install dampy\n```\n\nAfter the tool is installed, you can straight away start using it. All that it takes is to import AEM class from dampy package and start working with it. The below code is all it takes to get a list of all assets in DAM\n\n\n```\n# Getting started\n\n# Import AEM from dampy\n\u003e\u003e\u003e From dampy import AEM\n\n# Create a handle to an AEM Instance\n\u003e\u003e\u003e author = AEM()\n\n# List all assets in DAM\n\u003e\u003e\u003e author.dam.list()\n```\n\nAs you can see, three lines is all it takes to get a list of all assets in DAM\n1.\tImport AEM from dampy\n2.\tCreate an instance of AEM\n3.\tCall the list method \n\n__Note:__ By default, **DamPy** connects to AEM Author instance running locally with admin/admin as credentials. Keep your local AEM instance running when trying the above snippet. \n\n## DamPy in-depth\nThe following sections explains in-depth the functionalities and technical details of **DamPy** tool\n\n### Creating an AEM handle\nThe first step in working with **DamPy** is to create an AEM handle. To create an AEM handle, import AEM from dampy and create an instance of it. Below code snippet shows various options to create an AEM handle\n\n```\n\u003e\u003e\u003e From dampy import AEM\n# Different options for creating AEM handle\n# Create AEM handle to default AEM instance\n\u003e\u003e\u003e aem = AEM()\n\n# Create AEM handle to the given host and credentials\n\u003e\u003e\u003e aem = AEM(‘http://my-aem-host:port’, ‘user’,’password’)\n\n# Create AEM handle to default host, for admin user with password as ‘new-password’\n\u003e\u003e\u003e aem = AEM(password = ‘new-password’)\n```\n\nAs you can see, AEM constructor takes in three optional parameters\n\n__host__ – defaults to http://localhost:4502\n__user__ – defaults to ‘admin’\n__password__ – defaults to ‘admin’\n\nYou can pass in none, all three, or some of these parameters to create an AEM handle\n\n### The dam object in AEM handle\nThe AEM handle includes a dam object wrapped within it and all functionalities of **DamPy** are exposed as methods on this dam object. The signature for invoking any method on dam looks like this\n\n```\n\u003e\u003e\u003e aem.dam.\u003capi\u003e(\u003cparams...\u003e)\n```\n\nWe will see all the methods exposed on dam object in the following sections\n\n\n### list()\n\nThis method takes an optional path parameter and returns a list of all assets under this path. The returned list includes assets under all the subfolders of this path, subfolders under it and so on covering the entire node tree under the given path\n\nIf path parameter is not provided, it returns all assets in DAM (all assets under /content/dam)\n\nIt also has two more optional parameters\n\n__csv_dump__ – A Boolean flag indicating if the list needs to be written to a CSV file. Default value of this flag is False\n\n__csv_file__ – The output csv file name to write the list output to. The list gets written to output if either the csv_dump is set to True of csv_file value is specified. \n\nIf csv_dump is set to True but no csv_file value is specified, output is written to the file 'output/asset_list.csv' under the current working directory\n \n```\n# List all assets under ‘/content/dam/my_folder’\n\u003e\u003e\u003e my_assets = aem.dam.list(‘/content/dam/my_folder’)\n\n# List all assets under ‘/content/dam’\n\u003e\u003e\u003e all_assets = aem.dam.list()\n\n# List all assets under ‘/content/dam/my_folder’ and also write the output to a CSV file\n\u003e\u003e\u003e my_assets = aem.dam.list(‘/content/dam/my_folder’, csv_dump=True)\n\n# List all assets under ‘/content/dam/my_folder’ and also write the output to the CSV file specified\n\u003e\u003e\u003e my_assets = aem.dam.list(‘/content/dam/my_folder’, csv_file=’output/list.csv’, )\n```\n\n### createFolder()\nThis method creates a new folder in DAM. It takes in the path of the folder to create as a parameter and an optional title for the folder \u0026 returns a Boolean value indicating the success status of folder creation\nParameters \n__path__ – DAM folder path to create\n__title__ – Optional title for the folder. If not provided, name of the folder is set as title\n\n```\n# Create a new DAM folder /content/dam/new_folder and set its title to ‘new_folder’\n\u003e\u003e\u003e status = aem.dam.createFolder(‘/content/dam/new_folder’)\n\n# Create a new DAM folder /content/dam/new_folder and set its title to ‘My New Folder’\n\u003e\u003e\u003e status = aem.dam.createFolder(‘/content/dam/new_folder’, ‘My New Folder’)\n```\n\n### createFolderTree()\nThis method creates the folder tree structure in DAM, reflecting the folder structure in a local dir or in a given list. It takes in a path under which to create the folder structure, local directory path that contains the folder structure to reflect in DAM and/or an input list containing the list of folders to create \nParameters \n__path__ – DAM folder under which to create the folder tree structure. Optional and defaults to /content/dam. Ignored if the folder structure or list provided starts with /content/dam/..\n__srcDir__ – Local folder path. The folder structure under this path is reflected in DAM\n__srcList__ – Input list of folder paths to create. Can be a list or a text file or CSV file containing the list of folder paths to create in DAM\n\nIf both the __srcDir__ and __srcList__ parameters are provided, folder structure under both gets created in DAM\n\n```\n# Create folder tree, based on local folder structure under the path /content/dam/dampy/test\n\u003e\u003e\u003e status = aem.dam.createFolderTree(path='/content/dam/dampy/test', srcDir='upload/Folder Tree Dir')\n   \n# Create folder tree, based on entries in input text file\n\u003e\u003e\u003e status = aem.dam.createFolderTree( srcList='input/flist.txt')\n\n# Create folder tree, based on entries in input CSV file\n\u003e\u003e\u003e status = aem.dam.createFolderTree(srcList='input/Folder_tree.csv')\n\n# Create folder tree, based on input provided as a list\n\u003e\u003e\u003e status = aem.dam.createFolderTree(srcList=['/content/dam/dampy/test/Folder Tree LIST', '/content/dam/dampy/test/\n\n```\n\n### updateFolderTitle()\nThis method updates the folder title with the new value provided \nParameters \n__path__ – Path of the DAM folder for which title change needs to be done\n__newTitle__ – New value for the folder title\n\n```\n# Update the title of the folder to the new value provided\n\u003e\u003e\u003e status = aem.dam.updateFolderTitle(path='dampy/test/folder-tree-txt', newTitle='Root Folder from Text tree')\n\n```\n\n### move()\nThis method moves the asset or folder from the srcPath to the destPath\nParameters \n__srcPath__ – Path of the source asset or folder to move\n__destPath__ – Destination path under which the asset or folder is moved to\n__newName__ – New name for the moved asset or folder. This parameter is optional and if not provided, the name of the asset or folder moved remains the same as its current name\n\n```\n# Move the folder from the source path to the destination path\n\u003e\u003e\u003e status = aem.dam.move(srcPath='/content/dam/dampy/test/folder-tree-txt', destPath='/content/dam/dampy/test/folder-tree-list')\n\n# Move the folder from the source path to the destination path with a new name\n\u003e\u003e\u003e status = aem.dam.move(srcPath='/content/dam/dampy/test/folder-tree-list/folder-tree-txt', destPath='/content/dam/dampy/test/folder-tree-list', newName='text-tree')\n\n```\n\n### fetchFolderTree()\nThis method fetches the folder structure under the given path and writes it to an output csv file\nParameters \n__path__ – Base path, the folder structure under which gets returned. Optional parameter and defaults to '/content/dam'\n__csv_file__ – The name of the output CSV file to which the output is written to. Optional and by default writes to the file 'output/folder_tree.csv'\n__props__ – List of properties of folders that are extracted for the folder tree. Optional and by default outputs the folder path and title\n\n```\n# Fetch the folder tree structure from DAM and write it to CSV file\n\u003e\u003e\u003e status = aem.dam.fetchFolderTree(path='/content/dam/dampy/test')\n\n```\n\n### restructure()\nThis method restructures the DAM folder structure based on the input CSV file \nParameters \n__inputCSV__ – Path of the CSV file which contains the details for restructuring the folders. This CSV file contains a list of entries for moving or deleting a folder\n\n```\n# Restructure the folders in DAM, moving and deleting folders and updating folder title based on input CSV file\n\u003e\u003e\u003e status = aem.dam.restructure(inputCSV='input/restructure.csv')\n\n```\n\n### uploadAsset()\nThis method uploads an asset from the local path to DAM under the path specified. It takes in 2 parameters\n\n__file__ – Path of the local file to upload. This is a mandatory parameter\n\n__path__ – DAM path under which the file has to be uploaded, Defaults to ‘/content/dam’ if not specified\n\nThis method returns a Boolean value indicating the success status\n\n```\n# Upload the given file to the specified DAM folder\n\u003e\u003e\u003e status = aem.dam.uploadAsset(‘./assets/sample1.png’, ‘/content/dam/new_folder)\n\n# Upload the given file to DAM under ‘/content/dam’\n\u003e\u003e\u003e status = aem.dam.uploadAsset(‘./assets/sample1.png’)\n```\n\n### uploadFolder()\nThis method uploads all the assets from a local folder to DAM. It takes in 2 parameters\n\n__dir__ – The local folder path, all assets under which gets uploaded to DAM. This is an optional parameter and uploads all assets under folder named ‘upload’ under the current path if not specified\n\n__path__ – DAM path under which to download. Its optional and defaults to /content/dam. For assets under the folder structure starting with /content/dam/… in the local folder specified, this parameter is ignored\n\nThe folder structure under the given local folder dir gets reflected under the DAM path provided. \n\nThis method also returns a Boolean value indicating the success status\n\n```\n# Upload all the folders and assets under ./upload to DAM under /content/dam\n\u003e\u003e\u003e status = aem.dam.uploadFolder()\n\n# Upload all the folders and assets under ./upload to DAM under /content/dam/my_uploads\n\u003e\u003e\u003e status = aem.dam.uploadFolder(path=’/content/dam/my_uploads)\n\n# Upload all the folders and assets under ./assets to DAM under /content/dam\n\u003e\u003e\u003e status = aem.dam.uploadFolder(‘./assets’)\n\n# Upload all the folders and assets under ./assets to DAM under /content/dam/my_uploads\n\u003e\u003e\u003e status = aem.dam.uploadFolder(dir=‘./assets’, path=’/content/dam/my_uploads)\n```\n\n\n### downloadAsset()\nThis method downloads the given assets to a local folder. This method takes in three parameters \n\n__asset_path__ – A mandatory parameter which is the full path to the asset to download\n\n__dir__ – local folder path to download the asset. This is optional and the asset gets downloaded to a folder named ‘download’ if not specified. The folder gets created is the given folder does not exist on the file system\n\n__retain_dam_path__ – A Boolean flag to retain or ignore the DAM folder tree when downloading to local. Defaults to False\n\nThis method returns a Boolean value indicating the success or failure of the download\n\n```\n# Download the asset to ./download folder\n\u003e\u003e\u003e status = aem.dam.downloadAsset(‘/content/dam/my_folder/dampy_sample.png’)\n\n# Download the asset to ./assets folder\n\u003e\u003e\u003e status = aem.dam.downloadAsset(‘/content/dam/my_folder/dampy_sample.png’, ‘./assets’)\n\n# Download the asset to ./assets folder under the subfolder /content/dam/my_folder\n\u003e\u003e\u003e status = aem.dam.downloadAsset(‘/content/dam/my_folder/dampy_sample.png’, ‘./assets’, True)\n```\n\n### downloadFolder()\nThis method downloads all the assets under a given DAM path to a local folder. This method takes in three parameters \n\n__path__ – Optional. Path of the DAM folder from which all assets gets downloaded. If this parameter is not given all assets under ‘/content/dam’ gets downloaded\n\n__dir__ – local folder path to download all the asset to. This is optional and the assets get downloaded to a folder named ‘download’ if not specified. The folder to download the assets to gets created if it does not already exist on the file system. \n\n__retain_dam_path__ – A Boolean flag to retain or ignore the DAM folder tree when downloading to local. Defaults to True\n\nThe tree structure of DAM is retained when downloading assets under the given DAM path, with the downloaded folder structure reflecting the DAM folder hierarchy\n\nThis method also returns a Boolean value indicating the success or failure of the download\n\n```\n# Download all assets under the given DAM folder to ./download, retaining the DAM folder structure in local\n\n\u003e\u003e\u003e status = aem.dam.downloadFolder(‘/content/dam/my_folder’)\n\n# Download all assets under the given DAM folder to ./assets folder, retaining the DAM folder structure in local\n\u003e\u003e\u003e status = aem.dam.downloadFolder(‘/content/dam/my_folder’, ‘./assets’)\n\n# Download all assets under the given DAM folder to ./assets folder. All assets are placed in ./assets folder, ignoring the DAM folder structure\n\u003e\u003e\u003e status = aem.dam.downloadFolder(‘/content/dam/my_folder’, ‘./assets’, False)\n```\n\n\n### metadata()\nThis method returns the metadata of the given asset as a json object. It takes in 2 parameters \nasset_path – A mandatory parameter which is the full path to the asset\n\n__level__ – optional, the nesting level in the node hierarchy includes in the response json. Defaults to 1 \n\n```\n# Get level 1 metadata of given asset\n\u003e\u003e\u003e metadata_json = aem.dam.metadata(‘/content/dam/my_folder/dampy_sample.png’)\n\n# Get up to level 4 metadata of the given asset \n\u003e\u003e\u003e metadata_json = aem.dam.metadata(‘/content/dam/my_folder/dampy_sample.png’, 4)\n```\n\n### xprops()\nThis method extracts the metadata properties of all the assets under a given path and writes it to a CSV file. It takes 3 parameters, all optional\n\n__path__ – DAM path. Extracts properties of all assets under this path. Defaults to ‘/content/dam’\n\n__props__ – List of properties to extract. By default extract the asset path \u0026 title\n\n__csv_file__ – The output file to write the extracted properties to. By default, its written to the file ‘output/asset_props.csv’\n\n\n```\n# Extract path and title of all dam assets and write it to output/asset_props.csv\n\u003e\u003e\u003e status = aem.dam.xprops()\n\n# Extract path and title of all dam assets under my_folder and write it to output/asset_props.csv\n\u003e\u003e\u003e status = aem.dam.xprops(‘/content/dam/my_folder’)\n\n# Extract path, title and tags of all dam assets under my_folder and write it to output/asset_title_n_tags_.csv\n\u003e\u003e\u003e status = aem.dam.xprops(‘/content/dam/my_folder’, [‘jcr:path’, ‘jcr:content/metadata/dc:title’, ‘jcr:content/metadata/cq:tags’], ‘output/asset_title_n_tags_.csv’)\n```\n\n\n### uprops()\nThis method takes a csv file as input and updates asset properties with the data provided in this CSV file. It takes 1parameter, the path to the CSV file. \n\n__csv_file__  – Path to the csv file with data for asset properties update. By default, tries the read the input csv file at in ‘input/asset_props.csv’\n\nThis input CSV file should adhere to the below conditions\n\n* The first row is the header and should have the property name to update for the respective columns. Property name is the fully qualified name of the property under the asset. E.g. Title property name is ‘jcr:content/metadata/dc:title’\n* The second row is the type of the property. Can be String, Date, Boolean, … and can be a single value or array value. E.g. for String array mention the type as ‘String[]’\n* From row 3 onwards, each row contains the properties for one asset \n* The first column must be ‘jcr:path’ property with its type as String and values as full path of the asset in DAM \n\nAfter creating the csv and placing it in a path, invoke the uprops method as given in the below code snippet\n\n\n```\n# Update properties based on the input csv file input/asset_props.csv\n\u003e\u003e\u003e status = aem.dam.uprops()\n\n# Update properties based on the input csv file input/asset_cust_props.csv\n\u003e\u003e\u003e status = aem.dam.uprops(‘input/asset_cust_props.csv’)\n```\n\n\n### activate()\nThis method activates the given asset or a folder in DAM. It takes in one mandatory path parameter \n\n__path__ – Mandatory parameter specifying the path to the asset or DAM folder that needs to be activated\n\nThis method returns a Boolean value indicating the success status\n\n```\n# Activates the given asset in DAM\n\u003e\u003e\u003e status = aem.dam.activate((‘/content/dam/my_folder/dampy_sample.png’)\n\n# Activates the given folder (folder tree) in DAM\n\u003e\u003e\u003e status = aem.dam.activate((‘/content/dam/my_folder’)\n```\n\n### activateList()\nThis method activates all the assets provided by its parameter listSrc\n\n__listSrc__ – Mandatory parameter containing the list of assets to activate. This parameter can be a list of all assets to activate or name of a text or CSV file containing the list of assets to activate\n\nThis method returns a Boolean value indicating the success status if all the assets in the list are activated successfully\n\n```\n# Activate a list of assets in text file\n\u003e\u003e\u003e status = aem.dam.activateList(listSrc='input/alist.txt')\n\n# Activate a list of assets in a CSV file\n\u003e\u003e\u003e status = aem.dam.activateList(listSrc='input/alist.csv')\n\n# Activate a list of assets passed in as parameter\n\u003e\u003e\u003e status = aem.dam.activateList(listSrc=['/content/dam/dampy/test/new_samples/activities/hiking-camping/alpinists-himalayas.jpg', '/content/dam/dampy/test/new_samples/activities/running/fitness-woman.jpg'])\n```\n\n### deactivate()\nThis method deactivates a given asset or a folder in DAM.  It takes in one mandatory path parameter \n\n__path__ – Mandatory parameter specifying the path to the asset or a DAM folder that needs to be deactivated\n\nThis method returns a Boolean value indicating the success status\n\n```\n# Deactivates the given asset in DAM\n\u003e\u003e\u003e status = aem.dam.deactivate((‘/content/dam/my_folder/dampy_sample.png’)\n\n# Deactivates the given folder in DAM\n\u003e\u003e\u003e status = aem.dam.deactivate((‘/content/dam/my_folder’)\n```\n\n### deactivateList()\nThis method deactivates all the assets provided by its parameter listSrc\n\n__listSrc__ – Mandatory parameter containing the list of assets to deactivate. This parameter can be a list of all assets to deactivate or name of a text or CSV file containing the list of assets to deactivate\n\nThis method returns a Boolean value indicating the success status if all the assets in the list are deactivated successfully\n\n```\n# Deactivate a list of assets in text file\n\u003e\u003e\u003e status = aem.dam.deactivateList(listSrc='input/alist.txt')\n\n# Deactivate a list of assets in a CSV file\n\u003e\u003e\u003e status = aem.dam.deactivateList(listSrc='input/alist.csv')\n\n# Deactivate a list of assets passed in as parameter\n\u003e\u003e\u003e status = aem.dam.deactivateList(listSrc=['/content/dam/dampy/test/new_samples/activities/hiking-camping/alpinists-himalayas.jpg', '/content/dam/dampy/test/new_samples/activities/running/fitness-woman.jpg'])\n```\n\n### delete()\nThis method deletes a given asset or a folder. It takes in one mandatory path parameter \n\n__path__ – Mandatory parameter specifying the path to the asset or the DAM folder that needs to be deleted\n\nThis method returns a Boolean value indicating the success status\n\n```\n# Deletes the given asset from DAM\n\u003e\u003e\u003e status = aem.dam.delete((‘/content/dam/my_folder/dampy_sample.png’)\n\n# Deletes the given folder from DAM\n\u003e\u003e\u003e status = aem.dam.delete((‘/content/dam/my_folder’)\n```\n\n### deleteList()\nThis method deletes all the assets provided by its parameter listSrc\n\n__listSrc__ – Mandatory parameter containing the list of assets to delete. This parameter can be a list of all assets to delete or name of a text or CSV file containing the list of assets to delete\n\nThis method returns a Boolean value indicating the success status if all the assets in the list are deleted successfully\n\n```\n# Delete a list of assets in text file\n\u003e\u003e\u003e status = aem.dam.deleteList(listSrc='input/alist.txt')\n\n# Delete a list of assets in a CSV file\n\u003e\u003e\u003e status = aem.dam.deleteList(listSrc='input/alist.csv')\n\n# Delete a list of assets passed in as parameter\n\u003e\u003e\u003e status = aem.dam.deleteList(listSrc=['/content/dam/dampy/test/new_samples/activities/hiking-camping/alpinists-himalayas.jpg', '/content/dam/dampy/test/new_samples/activities/running/fitness-woman.jpg'])\n```\n\n### exists()\nThis method checks if a given asset file is available in DAM and returns the list of paths under which it is available\n\n__asset__ – Path of the asset in the local system. \n\n```\n# Check if an asset exits in DAM and return the paths under which its present\n\u003e\u003e\u003e status = aem.dam.exists('upload/Shorts_men.jpg')\n\n```\n\n### duplicates()\nThis method finds all the duplicate assets under the given path and returns it. Returns an empty object if no duplicates are identified \n\n__path__ – Path under which the check is done to identify duplicates\n\n```\n# List all duplicate assets in DAM under the given path\n\u003e\u003e\u003e status = aem.dam.duplicates('/content/dam/dampy')\n\n# List all duplicate assets in DAM\n\u003e\u003e\u003e status = aem.dam.duplicates()\n\n```\n\n### checkout()\nThis method checks out the given asset in DAM. It takes in one mandatory path parameter \n\n__path__ – Mandatory parameter specifying the path to the asset that needs to be checked out\n\nThis method returns a Boolean value indicating the success status\n\n```\n# checks out the given asset in DAM\n\u003e\u003e\u003e status = aem.dam.checkout((‘/content/dam/my_folder/dampy_sample.png’)\n\n```\n\n### checkin()\nThis method checks in the given asset in DAM. It takes in one mandatory path parameter \n\n__path__ – Mandatory parameter specifying the path to the asset that needs to be checked in\n\nThis method returns a Boolean value indicating the success status\n\n```\n# checks in the given asset in DAM\n\u003e\u003e\u003e status = aem.dam.checkin((‘/content/dam/my_folder/dampy_sample.png’)\n\n```\n\n### crop()\nThis method crops the given asset in DAM. It takes in three mandatory parameters\n\n__path__ – Mandatory parameter specifying the path to the asset that needs to be cropped\n__top_left__ – Mandatory parameter specifying the top left position as tuple indicating the start of crop position\n__bottom_right__ – Mandatory parameter specifying the bottom right position as tuple indicating the end of crop position\n\nThis method returns a Boolean value indicating the success status\n\n```\n# Crop the given asset in DAM\n\u003e\u003e\u003e status = aem.dam.crop((‘/content/dam/my_folder/dampy_sample.png’, (87, 49), (547,331))\n\n```\n\n### rotate()\nThis method crops the given asset in DAM. It takes in two mandatory parameters\n\n__path__ – Mandatory parameter specifying the path to the asset that needs to be rotated\n__angle__ – Mandatory parameter specifying the angle by which the asset needs to be rotated\n\nThis method returns a Boolean value indicating the success status\n\n```\n# Rotate the given asset in DAM\n\u003e\u003e\u003e status = aem.dam.rotate((‘/content/dam/my_folder/dampy_sample.png’, 90)\n\n```\n\n### flip()\nThis method flips the given asset in DAM horizontally or vertically or both ways. It takes in two mandatory parameters\n\n__path__ – Mandatory parameter specifying the path to the asset that needs to be flipped\n__type__ – Mandatory parameter specifying the type of flip to be performed. Value of 'h' or 'horizontal' flips the asset horizontally. Value of 'v' or 'vertical' flips the asset vartically. Value of 'b' or 'both' flips the asset both ways\n\nThis method returns a Boolean value indicating the success status\n\n```\n# Flip the given asset in DAM horizontally\n\u003e\u003e\u003e status = aem.dam.flip((‘/content/dam/my_folder/dampy_sample.png’, 'h')\n\n# Flip the given asset in DAM vertically\n\u003e\u003e\u003e status = aem.dam.flip((‘/content/dam/my_folder/dampy_sample.png’, 'vertical')\n\n# Flip the given asset in DAM both ways\n\u003e\u003e\u003e status = aem.dam.flip((‘/content/dam/my_folder/dampy_sample.png’, 'both')\n\n```\n\n### map()\nThis method adds image map to the given asset in DAM. It takes in two mandatory parameters\n\n__path__ – Mandatory parameter specifying the path to the asset that needs to be mapped\n__data__ – Mandatory parameter specifying the data with which the image map is built\n\nThis method returns a Boolean value indicating the success status\n\n```\n# Map the given asset in DAM with the circular image map\n\u003e\u003e\u003e status = aem.dam.map((‘/content/dam/my_folder/dampy_sample.png’, data='[circle(482,536,324)\"#test_link_c\"|\"_blank\"|\"Test link Cricle\"]')\n\n# Map the given asset in DAM with the rectangle image map\n\u003e\u003e\u003e status = aem.dam.map((‘/content/dam/my_folder/dampy_sample.png’, data='[rect(182,36,524,322)\"#test_link_p\"|\"_self\"|\"Test link Rectangle\"]')\n\n# Map the given asset in DAM with a circle and a rectangle image map\n\u003e\u003e\u003e status = aem.dam.map((‘/content/dam/my_folder/dampy_sample.png’, data='[rect(182,36,524,322)\"test_link_p\"|\"_self\"|\"Test link Rectangle\"][circle(482,536,324)\"test_link_c\"|\"_blank\"|\"Test link Cricle\"]')\n\n```\n\n### getMapData()\nA utility method that returns the image map data string based on input parameters. It takes in the following parameters\n\n__currentMap__ – Image map string to which the new map data needs to be appended to. Defaults to ''\n__type__ – Type of the image map. Can be 'circle' or 'rect'. Defaults to 'rect'\n__dimension__ – Dimension for the type of image map. Defaults to (0,0,100,100) for the default 'rect' type\n__link__ – Link pointed to by the image map. Defaults to '#'\n__alt__ – Alt text for the image map. Defaults to 'Click'\n__target__ – Target window for the image map. Can be '_self' or '_parent' or '_blank'. Defaults to '_self'\n\n\nThis method returns string representation for the image map data\n\n```\n# Get map data for a circle image map\n\u003e\u003e\u003e status = aem.dam.getMapData(type='circle', dimension=(482,536,324), link='test_link_c', alt='Test link Cricle', target='_blank')\n\n'[circle(482,536,324)\"test_link_c\"|\"_blank\"|\"Test link Cricle\"]'\n\n# Get map data for the default rectangle image map\n\u003e\u003e\u003e status = aem.dam.getMapData()\n\n'[rect(0, 0, 100, 100)\"#\"|\"_self\"|\"Click\"]'\n\n```\n\n### edit()\nThis method edits an asset asset in DAM. This method can be used to do one of more of cropping, rotating, flipping and applying map to an asset in one go.  \nIt takes in two mandatory parameters\n\n__path__ – Mandatory parameter specifying the path to the asset that needs to be edited\n__corp__ – Crop value to be applied on the asset if applicable\n__rotate__ – Angle to rotate the asset if applicable \n__flip__ – Vertical and/or horizontal flip to be applied on the asset if needed\n__map__ – Map data to be applied on the asset if needed\n\nThis method returns a Boolean value indicating the success status\n\n```\n# Edit an asset in DAM applying crop, rotate, filp and map - all in one go\n\u003e\u003e\u003e status = aem.dam.edit('/content/dam/dampy/test/samples/Shorts_men.jpg', crop='87,87,778,551', rotate='270', flip='h', map='[rect(182,36,524,322)\"#test_link_p\"|\"_self\"|\"Test link Rectangle\"][circle(482,536,324)\"#test_link_c\"|\"_blank\"|\"Test link Cricle\"]')\n\n```\n\n## Reservation\n\u003e Though this is a generic utility, it has been tested for limited set of use cases. Make sure its tested for your scenarios before applying it for production purpose\n\n---\n\u003e Environments Tested on:  AEM 6.1, 6.2 \u0026 6.4 | Windows, RHEL5 | Python 3.7.2\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashokkumarta%2Fdampy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashokkumarta%2Fdampy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashokkumarta%2Fdampy/lists"}