Jump to content

PeterH

Members
  • Posts

    15
  • Joined

  • Last visited

  • Days Won

    6

Reputation Activity

  1. Like
    PeterH got a reaction from Andrew Lawrence in Undo !   
    That sounds great, however I think 1 week would be too short.
    For example, someone deleted an asset (without realising) last week thinking they'd just removed it from a list. In their eyes, nothing needed recovering, so it could have easily gone unnoticed for longer than a week.
  2. Thanks
    PeterH got a reaction from dario.siero in API Explorer GUI   
    I made a tool for exploring the API a while back (just remembered to post here after catching a few errors earlier this week), as I was a bit fed up of my old process which was like this:
    >>> user = session.query('User').first() >>> print(user.keys()) # Look for a key related to groups >>> print(user['memberships']) # Perhaps this, check if entity or list >>> print(user['memberships'][0].keys()) # It's a list, check what each item has available >>> print(user['memberships'][0]['group'].keys()) # I see group, what keys does that have >>> print(user['memberships'][0]['group']['name']) # Found what I needed (random example though, I've never actually needed this) >>> user_groups = [membership['group']['name'] for membership in user['memberships']]  
    I find myself loading it now whenever I'm coding something that I'm unfamiliar with, so just sharing here in case anyone else would find it useful.
    https://github.com/huntfx/ftrack-api-explorer
     

  3. Thanks
    PeterH got a reaction from alexisp in API Explorer GUI   
    I made a tool for exploring the API a while back (just remembered to post here after catching a few errors earlier this week), as I was a bit fed up of my old process which was like this:
    >>> user = session.query('User').first() >>> print(user.keys()) # Look for a key related to groups >>> print(user['memberships']) # Perhaps this, check if entity or list >>> print(user['memberships'][0].keys()) # It's a list, check what each item has available >>> print(user['memberships'][0]['group'].keys()) # I see group, what keys does that have >>> print(user['memberships'][0]['group']['name']) # Found what I needed (random example though, I've never actually needed this) >>> user_groups = [membership['group']['name'] for membership in user['memberships']]  
    I find myself loading it now whenever I'm coding something that I'm unfamiliar with, so just sharing here in case anyone else would find it useful.
    https://github.com/huntfx/ftrack-api-explorer
     

  4. Like
    PeterH got a reaction from Andrew Lawrence in API Explorer GUI   
    I made a tool for exploring the API a while back (just remembered to post here after catching a few errors earlier this week), as I was a bit fed up of my old process which was like this:
    >>> user = session.query('User').first() >>> print(user.keys()) # Look for a key related to groups >>> print(user['memberships']) # Perhaps this, check if entity or list >>> print(user['memberships'][0].keys()) # It's a list, check what each item has available >>> print(user['memberships'][0]['group'].keys()) # I see group, what keys does that have >>> print(user['memberships'][0]['group']['name']) # Found what I needed (random example though, I've never actually needed this) >>> user_groups = [membership['group']['name'] for membership in user['memberships']]  
    I find myself loading it now whenever I'm coding something that I'm unfamiliar with, so just sharing here in case anyone else would find it useful.
    https://github.com/huntfx/ftrack-api-explorer
     

  5. Like
    PeterH got a reaction from Lorenzo Angeli in API Explorer GUI   
    I made a tool for exploring the API a while back (just remembered to post here after catching a few errors earlier this week), as I was a bit fed up of my old process which was like this:
    >>> user = session.query('User').first() >>> print(user.keys()) # Look for a key related to groups >>> print(user['memberships']) # Perhaps this, check if entity or list >>> print(user['memberships'][0].keys()) # It's a list, check what each item has available >>> print(user['memberships'][0]['group'].keys()) # I see group, what keys does that have >>> print(user['memberships'][0]['group']['name']) # Found what I needed (random example though, I've never actually needed this) >>> user_groups = [membership['group']['name'] for membership in user['memberships']]  
    I find myself loading it now whenever I'm coding something that I'm unfamiliar with, so just sharing here in case anyone else would find it useful.
    https://github.com/huntfx/ftrack-api-explorer
     

  6. Like
    PeterH got a reaction from Lorenzo Angeli in I made a class for building the query strings   
    I like the API but I'm not a huge fan of writing the queries as text, so I made something a while back using inspiration from SQLAlchemy.
    As a very quick example, if the original code is this:
    episode = session.query('Episode').first() task_link = session.query('select link from Task where (name not like "%task%" or name is "new") and parent.id is "{}" order by name descending'.format(episode['id'])).first() It would be constructed like this:
    task_link = session.Task.where( or_(~entity.name.like('%task%'), name='new'), parent=session.Episode.first(), ).select(entity.link).sort(entity.name.desc()).first() It's able to do everything I've come across so far, if anyone is interested in using it the github page is here.
×
×
  • Create New...