本文整理汇总了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