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


Python Report.put方法代码示例

本文整理汇总了Python中models.Report.put方法的典型用法代码示例。如果您正苦于以下问题:Python Report.put方法的具体用法?Python Report.put怎么用?Python Report.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Report的用法示例。


在下文中一共展示了Report.put方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: reportsv2

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import put [as 别名]
def reportsv2():
    if not request.args or not request.args['key'] or request.args['key'] != IOS_API_KEY:
        abort(401)
    if request.method == "POST":
        if not request.json or not 'google_places_id' in request.json or not 'tags' in request.json:
            abort(400)
        report = Report(
                        google_places_id=request.json['google_places_id'],
                        tags=request.json['tags'])
        if 'comments' in request.json:
            report.populate(comments=request.json['comments'])
        if 'ios_device_id' in request.json:
            report.populate(ios_device_id=request.json['ios_device_id'])
        if 'photo_url' in request.json:
            report.populate(photo_url=request.json['photo_url'])
        try:
            report.put()
            return jsonify(report.to_dict())
        except CapabilityDisabledError:
            abort(400)
    if len(request.args) == 1:
        reports = Report.query().order(-Report.created_at).fetch(20)
        return jsonify({"reports": [report.to_dict() for report in reports]})
    if len(request.args) > 2:
        abort(400)
    if not request.args['google_places_id']:
        abort(400)
    google_places_id = request.args['google_places_id']
    reports = Report.query(Report.google_places_id==google_places_id).order(-Report.created_at).fetch(20)
    return jsonify({"reports": [report.to_dict() for report in reports]})
开发者ID:kcmoffat,项目名称:bumpn-backend,代码行数:32,代码来源:views.py

示例2: set_report

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import put [as 别名]
def set_report(name, content):
	report = Report.find_by_name(name)
	if report is None:
		report = Report()
		report.name = name

	report.content = content
	report.put()
开发者ID:armandomiani,项目名称:flask-appengine-bootstrap,代码行数:10,代码来源:mm.py

示例3: test_one_report

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import put [as 别名]
 def test_one_report(self):
   client = Client(product=ProductData.killerapp_obj, cookie='123')
   client.put()
   report = Report(product=ProductData.killerapp_obj, client=client, status=REPORT_NEW, remote_ip='127.0.0.1', data='[]')
   report.put()
 
   response = self.get('/status/')
   assert 'Queued Reports: 1' in str(response)
开发者ID:B-Rich,项目名称:crashkit,代码行数:10,代码来源:test_status.py

示例4: post

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import put [as 别名]
 def post(self):
     user = users.get_current_user()
     if user:
         data = json.decode(self.request.body)
         # logging.log(logging.INFO, data)
         url = data['url']
         if url[:3] != 'http':
             url = 'http://' + url
         report = Report(
             author=user,
             url=url,
             status='SENT'
         )
         key = report.put()
         deferred.defer(parsepage, key, _countdown=30, _queue="parsequeue")
         result = {
             'result': JSONEncoder().encode(key.get()),
         }
         self.response.headers['Content-Type'] = 'application/json'
         self.response.write(json.encode(result))
开发者ID:htomika,项目名称:gaeFeedFind,代码行数:22,代码来源:main.py


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