0

Get login from user id

Hi all,

I am quite new to Shotgun and  its API. I would need to get the login string for all the users we have in Shotgun. How can this be done?

Many thanks

1 comment

  • 0
    Avatar
    Kym Watts

    Hey Gonzalo,

     

    You can use this:

    sg = Shotgun(SERVER_PATH,SCRIPT_NAME,SCRIPT_KEY)

    fields = ['id','login']
    filters = []

    HumanUserDict = {}

    sg.find("HumanUser",filters,fields)

    for dict in userList:
                    uName = dict['name']
                    HumanUserDict[uName] = dict

     

    This will return a dict where :

    {'kym': {'id':188,'login':'kym'}}

     

    Hope that helps.

     

    Cheers

    Kym

Please sign in to leave a comment.