Data Management - GastonBC/adeskForgeWrapper GitHub Wiki
Guides for afw's Data Management module - afw.DM
Explore your hubs and projects
import adeskForgeWrapper as afw
cli = afw.client.Client(forgeCliId, forgeCliSec, B360AccId, B360AccName)
token = afw.client.Token.get_2_legged_token("data:read", cli)
# Here we get the hubs from our account
hubs = afw.datamgt.Hub.get_hubs(token)
# Let's print some information
for hub in hubs:
print(hub.name, hub.id)
# Let's also print name and ids for our projects
projectList = hub.get_projects(token)
for project in projectList:
print(project.name, project.id)
Retrieve the folders
# Keep your ids at hand so you don't have to request them again and put them here
project = afw.datamgt.Project.project_by_id(token, "HUB_ID", "PROJECT_ID")
folders = project.top_folders(token)
for folder in folders:
print(folder.id)
Get the content information
To explore the folder contents you may need a 3 legged token
# Folder to look into
folder = afw.datamgt.Folder.folder_by_id(token, "PROJECT_ID", "FOLDER_ID")
# Contents may be folders, items or versions
contents = folder.get_contents(token)
for content in contents:
print(content.name, content.createTime)