本文整理匯總了Python中DBManager.DBManager.createSession方法的典型用法代碼示例。如果您正苦於以下問題:Python DBManager.createSession方法的具體用法?Python DBManager.createSession怎麽用?Python DBManager.createSession使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DBManager.DBManager
的用法示例。
在下文中一共展示了DBManager.createSession方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: DBManager
# 需要導入模塊: from DBManager import DBManager [as 別名]
# 或者: from DBManager.DBManager import createSession [as 別名]
#-u DEVID SESSIONNAME to activate a node
parser.add_argument("-u", "--activate", help="add a node to a session", nargs=2, metavar=('deviceID', 'passphrase'))
#-f DEVID to free a node
parser.add_argument("-f", "--free", help="free a node", metavar='deviceID')
#-S to list all active sessions
parser.add_argument("-S", "--SESSIONS", help="list all active sessions", action="store_true")
#-N to list all nodes and include [SESSIONNAME] to list all nodes in a session
parser.add_argument("-N", "--NODES", help="list all nodes in a session, use 0 for a list of all nodes", metavar='passphrase')
args = parser.parse_args()
db = DBManager()
if args.session != None:
#create a new session
db.createSession(args.session[0], int(args.session[1]))
print "Created session with passphrase: " + args.session[0] + " for " + args.session[1] + " days"
elif args.archive != None:
#archive session
db.deleteSession(args.archive)
print "Deleted session with passphrase: " + args.archive
elif args.node != None:
#create a new node
db.createNode(args.node)
print "Created node with device ID: " + args.node
elif args.delete != None:
#delete a node