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


Python Token.query方法代码示例

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


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

示例1: get

# 需要导入模块: from models import Token [as 别名]
# 或者: from models.Token import query [as 别名]
    def get(self):
        apid = self.request.get("apid")
        email = self.request.get("email",'').lower()
        version = int(self.request.get("version", "0"))
        q = Token.query(Token.email == email)
        token = q.get()
        if token:
            token.apid = apid
            token.email = email
            token.version = version
        else:
            q = Token.query(Token.apid == apid)
            token = q.get()
            if token:
                token.apid = apid
                token.email = email
                token.version=version
            else:token = Token(apid=apid, email=email, version=version)
        token.put()

        cb = self.request.get('callback')
        self.response.headers['Content-Type'] = 'application/json'
        if cb:
            self.response.out.write(cb+'(' + json.dumps({}) +');')
        else:
            self.response.out.write(json.dumps({}))
开发者ID:spicavigo,项目名称:onlinesms_server,代码行数:28,代码来源:hello_world.py

示例2: push_to_all

# 需要导入模块: from models import Token [as 别名]
# 或者: from models.Token import query [as 别名]
def push_to_all(text, count):

    ios_tokens = Token.query(Token.os!='android').fetch()
    and_tokens = Token.query(Token.os=='android').fetch()

    for token in ios_tokens:
        push_to_apns(token.token, text, count)

    push_to_gcm(list(token.token for token in and_tokens), text, count)
开发者ID:bluedisk,项目名称:bunker1_endpoint,代码行数:11,代码来源:push.py

示例3: post

# 需要导入模块: from models import Token [as 别名]
# 或者: from models.Token import query [as 别名]
    def post(self):
        isajax = self.request.get('isajax')
        phone = self.request.get('phone')
        msg = self.request.get('msg')
        contact_name = self.request.get('contact_name')

        user = users.get_current_user()
        email = user.email().lower()
        q = Token.query(Token.email == email)
        token = q.get()
        status = 100
        hist=''
        logging.debug(email + ' ' + phone + ' ' + msg + ' ' + contact_name)
        if token:
            status = 101
            if len(phone) and len(msg):
                status = 200
                hist = History(email=email, msg=msg, phone=phone, contact_name = contact_name)
                hist.put()
                airship.push({
                    "android": {
                         "extra": {"msgid": str(hist.key.id()), "phone": phone, "msg":msg}
                    }
                }, apids=[token.apid])
                id = hist.key.id()
                hist = hist.to_dict()
                hist['created']=hist['created'].isoformat();
                hist['id'] = id
                hist['type'] = 'sms'        
        self.response.out.write(json.dumps({'status':status, 'msg':hist}))
开发者ID:spicavigo,项目名称:onlinesms_server,代码行数:32,代码来源:hello_world.py

示例4: regist_token

# 需要导入模块: from models import Token [as 别名]
# 或者: from models.Token import query [as 别名]
    def regist_token(self, request):
        if Token.query(Token.token==request.token).fetch():
          return RegistTokenResult(result="DUP")

        token = Token(token=request.token, os='ios');
        token.put();

        push_to(token, u"환영합니다! 벙커원 교회 주보 알림목록에 등록되었습니다!", 0)

        return RegistTokenResult(result="OK")
开发者ID:bluedisk,项目名称:bunker1_endpoint,代码行数:12,代码来源:weekly_api.py

示例5: post

# 需要导入模块: from models import Token [as 别名]
# 或者: from models.Token import query [as 别名]
 def post(self):
     user = users.get_current_user()
     q = Token.query(Token.email == user.email())
     token = q.get()
     
     airship.push({
         "android": {
              "extra": {"phone": self.request.get('phone'), "msg":self.request.get('msg')}
         }
     }, apids=[token.apid])
     template = jinja_environment.get_template('templates/index.html')
     self.response.out.write(template.render({}))
开发者ID:vibster,项目名称:onlinesms_server,代码行数:14,代码来源:hello_world.py

示例6: get

# 需要导入模块: from models import Token [as 别名]
# 或者: from models.Token import query [as 别名]
	def get(self, url_token=None):

		try:
			if url_token is not None:

				token = Token.query(Token.urlsafe_key==url_token).get()
				if token is None:
					self.error(404)
					return

				#Trouve, c'est OK
				self.response.set_status(200)

		except (db.BadValueError, ValueError, KeyError):
			logging.error('%s', traceback.format_exc())
			self.error(400)

		except Exception:
			logging.error('%s', traceback.format_exc())
			self.error(500)
开发者ID:andgsk,项目名称:AndroidTP2,代码行数:22,代码来源:escalade_api.py

示例7: get

# 需要导入模块: from models import Token [as 别名]
# 或者: from models.Token import query [as 别名]
    def get(self):

        and_tokens = Token.query(Token.os=='android').fetch()
        push_to_gcm(list(token.token for token in and_tokens), 'push test', 1)
开发者ID:bluedisk,项目名称:bunker1_endpoint,代码行数:6,代码来源:push.py


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