0

login time

Is it possible to get login time or time and date of a login? I want to automate attendance in my production classes where I use Shotgun.

4 comments

  • 0
    Avatar
    Benoit Leveau

    If you're talking about logins to the Shotgun server, then they show up in the Shotgun Event Log.

    From the API:

    >>> sg.find_one("EventLogEntry", [["event_type", "is", "Shotgun_User_Login"]], ['id', 'event_type', 'attribute_name', 'meta', 'entity', 'user', 'project', 'session_uuid'], order=[{'column':'id', 'direction':'desc'}])

     

    {'attribute_name': None, 'event_type': 'Shotgun_User_Login', 'entity': {'type': 'HumanUser', 'id': 666, 'name': 'John Doe'}, 'project': None, 'meta': {'browser': 'Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130917 Firefox/17.0', 'remote_ip': 'XXX.XXX.XXX.XXX'}, 'user': {'type': 'HumanUser', 'id': 666, 'name': 'John Doe'}, 'session_uuid': None, 'type': 'EventLogEntry', 'id': 1066666}

    Hope it helps.

     

  • 0
    Avatar
    Benoit Leveau

    If you add "created_at" in the fields, then you'll get what you're looking for:

    >>> sg.find_one("EventLogEntry", [["event_type", "is", "Shotgun_User_Login"]], ['id', 'event_type', 'attribute_name', 'meta', 'entity', 'user', 'project', 'session_uuid', 'created_at'], order=[{'column':'id', 'direction':'desc'}])

     

    {'attribute_name': None, 'event_type': 'Shotgun_User_Login', 'entity': {'type': 'HumanUser', 'id': 666, 'name': 'John Doe'}, 'created_at': datetime.datetime(2014, 5, 13, 12, 57, 16, tzinfo=<shotgun_api3.lib.sgtimezone.LocalTimezone object at 0x12b3e10>), 'project': None, 'meta': {'browser': 'Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130917 Firefox/17.0', 'remote_ip': 'XXX.XXX.XXX.XXX'}, 'user': {'type': 'HumanUser', 'id': 666, 'name': 'John Doe'}, 'session_uuid': None, 'type': 'EventLogEntry', 'id': 1066666}
  • 0
    Avatar
    Steven Quinones

    Great, thanks!

  • 0
    Avatar
    Permanently deleted user

    That's awesome! Thanks Benoit! :)

Please sign in to leave a comment.