No description or website provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib Added lib directory to avoid compilation errors Feb 11, 2018
tests Completed implementation of get_sessions Feb 11, 2018
.gitignore Initial commit. Feb 10, 2018
LICENSE Create LICENSE Feb 11, 2018

Python Accounts

Access login and session information directly from Python.


  1. accounts.get_sessions: Get information about each current active session:

    • "user": User owner of the session

    • "date_created" : Date when the session was created

    • "host": Host of the session

    • "pid": PID of the session

    • "id": ID of the session

    • "line": Line of the session ["tty1", "tty2", ...]

    • "session_type": Type of the session:



  2. accounts.get_lastlogin: Get last login of the user given in the argument.

import accounts

sessions = accounts.get_sessions()
lastlogin = accounts.get_lastlogin('theuser')