Thanks @Mattias Lagergren for your answer!
For us it's quite important because we are planing to use threads in all of our tools. We would like to use at least 1 thread in order to not freeze the UI while it is fetching the data.
You mean something like this:
from multiprocessing.dummy import Pool as ThreadPool
import ftrack_api
from ftrack_api.symbol import Symbol
session = ftrack_api.Session()
def check_keys(entity):
for key in entity.keys():
if isinstance(entity[key], Symbol):
print entity, ': ', key
def check_children(entity_id):
entity = session.get('TypedContext', entity_id)
if 'children' in entity.keys():
for child in entity['children']:
check_keys(entity=child)
check_children(entity_id=child['id'])
def main():
projects = session.query("Project").all()
projects_id = [project["id"] for project in projects]
pool = ThreadPool()
pool.map(check_children, projects_id)
if __name__ == "__main__":
main()
It still doesn't work. In the thread most of the time session.get('TypedContext', entity_id) returns None.