当前位置: 首页>>代码示例>>Python>>正文


Python Log.put方法代码示例

本文整理汇总了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')
开发者ID:yi-chg2,项目名称:COEN296_IoT_DoorAlarmGAE,代码行数:12,代码来源:door_alarm_gae.py

示例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()
开发者ID:vspereira,项目名称:big-rig,代码行数:15,代码来源:processor.py

示例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")
开发者ID:jliszka,项目名称:scalacademy,代码行数:16,代码来源:main.py

示例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
开发者ID:gymcentral,项目名称:gymcentral,代码行数:21,代码来源:api_trainee.py

示例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()
开发者ID:wade-fs,项目名称:mud-fs,代码行数:25,代码来源:xmpp.py


注:本文中的models.Log.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。