Snippets

ftrack API Example - Print entity types and attributes in API schema

Created by Lucas Correia

File print_api_entities.py Added

  • Ignore whitespace
  • Hide word diff
+# :coding: utf-8
+# :copyright: Copyright (c) 2017 ftrack
+'''
+This code to print all entities and attributes available in the API schema.
+
+Read more in the Python API tutorial: http://ftrack-python-api.rtd.ftrack.com/en/stable/tutorial.html
+'''
+
+import ftrack_api
+
+session = ftrack_api.Session()
+
+for name, entity_type in sorted(session.types.items()):
+    print name
+    for attribute in sorted(entity_type.attributes.keys()):
+        print '\t {} ({})'.format(
+            attribute,
+            entity_type.attributes.get(attribute).__class__.__name__
+        )
+    print ''
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.