本文整理汇总了Python中models.Log.put方法的典型用法代码示例。如果您正苦于以下问题:Python Log.put方法的具体用法?Python Log.put怎么用?Python Log.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Log
的用法示例。
在下文中一共展示了Log.put方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models import Log [as 别名]
# 或者: from models.Log import put [as 别名]
def post(self):
# init models object
custom_index_log = Log()
custom_index_log.ip_address = self.request.remote_addr
custom_index_log.alarm_id = self.request.get("SENSOR_ID")
custom_index_log.alarm_status = self.request.get("SENSOR_STATUS")
custom_index_log.alarm_count = self.request.get("SENSOR_COUNT")
custom_index_log.put()
self.response.headers['Content-Type'] = 'text/plain'
self.response.write('return successful')
示例2: log
# 需要导入模块: from models import Log [as 别名]
# 或者: from models.Log import put [as 别名]
def log(self, project, trace_info, extended_info, status, records_imported=0):
if project == None:
return
log = Log(
parent=project.key,
filename=trace_info.filename,
date=datetime.today(),
status=status,
records_imported=records_imported,
)
log.put()
示例3: get
# 需要导入模块: from models import Log [as 别名]
# 或者: from models.Log import put [as 别名]
def get(self):
id = int(self.request.get('id'))
secret = int(self.request.get('secret'))
user = db.get(db.Key.from_path("User", id))
if user.secret == secret:
level = self.request.get('level')
step = int(self.request.get('step'))
correct = self.request.get('correct') == '1'
log = Log(user=user, level=level, step=step, correct=correct)
log.put()
user.level = level
user.step = step
user.put()
self.response.out.write("ok")
示例4: logs
# 需要导入模块: from models import Log [as 别名]
# 或者: from models.Log import put [as 别名]
def logs(req):
"""
Creates an entity in the log
:param req:
:return: 201, and the log object
"""
if req.method == 'GET':
logs = Log.query().fetch(1)
return logs[0]
else:
try:
j_req = json.loads(req.body)
except (TypeError, ValueError) as e:
raise BadRequest("Invalid JSON")
log = Log()
log.data = j_req
log.put()
return 201, log.data
示例5: Log
# 需要导入模块: from models import Log [as 别名]
# 或者: from models.Log import put [as 别名]
def Log(self, channel, body, person=None, system=False):
"""Log a message.
Args:
channel: The channel object the message was sent to.
body: The body of the message.
person: The person who sent the message. Defaults to self.person.
system: Whether this is a system log (i.e. not a chat).
You should not use person and system at the same time.
"""
if person and system:
raise RuntimeError('You can\'t use person and system here')
if not system:
if not person: person = self.person
log = Log(channel=channel.name,
user=person.user.email(),
body=body)
else:
log = Log(channel=channel.name,
system=True,
body=body)
log.put()