本文整理汇总了Python中monitors.Monitor.history方法的典型用法代码示例。如果您正苦于以下问题:Python Monitor.history方法的具体用法?Python Monitor.history怎么用?Python Monitor.history使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类monitors.Monitor
的用法示例。
在下文中一共展示了Monitor.history方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: detailhistory_page
# 需要导入模块: from monitors import Monitor [as 别名]
# 或者: from monitors.Monitor import history [as 别名]
def detailhistory_page(cid, hid):
verify = verifyLogin(
app.config['SECRET_KEY'], app.config['COOKIE_TIMEOUT'], request.cookies)
if verify:
user = User()
user.get('uid', verify, g.rdb_conn)
data = startData(user)
data['active'] = 'dashboard'
data['url'] = '/dashboard/detail-history/' + hid
tmpl = 'monitors/detail-history.html'
# Check Users Status
if user.status != "active":
data['url'] = '/dashboard/mod-subscription'
tmpl = 'member/mod-subscription.html'
else:
monitor = Monitor()
monitor.get(cid, g.rdb_conn)
if monitor.uid == user.uid:
data['monitor'] = {
'cid': monitor.cid,
'name': monitor.name,
'ctype': monitor.ctype,
'uid': monitor.uid,
'data': monitor.data
}
data['monitor-history'] = monitor.history(
method="detail-history", hid=hid, rdb=g.rdb_conn)
else:
flash('This monitor does not belong to your user.', 'warning')
page = render_template(tmpl, data=data)
return page
else:
flash('Please Login.', 'warning')
return redirect(url_for('user.login_page'))
示例2: viewhistory_page
# 需要导入模块: from monitors import Monitor [as 别名]
# 或者: from monitors.Monitor import history [as 别名]
def viewhistory_page(cid, start, limit):
verify = verifyLogin(
app.config['SECRET_KEY'], app.config['COOKIE_TIMEOUT'], request.cookies)
if verify:
user = User()
user.config = app.config
user.get('uid', verify, g.rdb_conn)
data = startData(user)
data['active'] = 'dashboard'
data['url'] = '/dashboard/view-history/' + cid
tmpl = 'monitors/view-history.html'
# Check Users Status
if user.status != "active":
data['url'] = '/dashboard/mod-subscription'
tmpl = 'member/mod-subscription.html'
else:
monitor = Monitor()
monitor.config = app.config
monitor.get(cid, g.rdb_conn)
if monitor.uid == user.uid:
data['monitor'] = {
'cid': monitor.cid,
'name': monitor.name,
'ctype': monitor.ctype,
'uid': monitor.uid,
'data': monitor.data
}
chktime = time.time() - float(data['dataret'])
data['monitor-history-count'] = monitor.history(
method="count", time=chktime, rdb=g.rdb_conn)
data['monitor-history'] = monitor.history(
method="mon-history", time=chktime,
start=int(start), limit=int(limit), rdb=g.rdb_conn)
data['monitor-history-paging'] = []
data['monitor-history-paging-start'] = int(start)
cur = 0
while cur < data['monitor-history-count'] - 200:
cur = cur + 200
data['monitor-history-paging'].append(cur)
else:
flash('This monitor does not belong to your user.', 'warning')
page = render_template(tmpl, data=data)
return page
else:
flash('Please Login.', 'warning')
return redirect(url_for('user.login_page'))