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


Python Token.put方法代码示例

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


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

示例1: get

# 需要导入模块: from models import Token [as 别名]
# 或者: from models.Token import put [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: regist_token

# 需要导入模块: from models import Token [as 别名]
# 或者: from models.Token import put [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

示例3: fe_connect

# 需要导入模块: from models import Token [as 别名]
# 或者: from models.Token import put [as 别名]
def fe_connect(request):
  """
  Do the OAuth dance for Fire Eagle!
  """
  CONSUMER_KEY = FE_CONSUMER_KEY
  CONSUMER_SECRET = FE_CONSUMER_SECRET
  CALLBACK_URL = FE_CALLBACK_URL
  fe = FireEagle( CONSUMER_KEY, CONSUMER_SECRET )
  request_token = fe.request_token( oauth_callback=CALLBACK_URL )
  if ( Token.gql( "WHERE user = :1", str(request.user) ).get() != None ):
      token = Token.gql( "WHERE user = :1", str(request.user) ).get()
  else:
    token = Token()
  token.user = str(request.user)
  token.fe_request_token = str(request_token)
  token.put()
  auth_url = fe.authorize( request_token, oauth_callback=CALLBACK_URL )
  return redirect( auth_url )
开发者ID:johl,项目名称:FireCheckIn,代码行数:20,代码来源:views.py

示例4: fs_connect

# 需要导入模块: from models import Token [as 别名]
# 或者: from models.Token import put [as 别名]
def fs_connect(request):
  """
  OAUTh dance for Foursquare
  """
  CONSUMER_KEY = FS_CONSUMER_KEY
  CONSUMER_SECRET = FS_CONSUMER_SECRET
  CALLBACK_URL = FS_CALLBACK_URL
  credentials = foursquare.OAuthCredentials(CONSUMER_KEY, CONSUMER_SECRET)
  fs = foursquare.Foursquare(credentials)
  request_token = fs.request_token( oauth_callback=CALLBACK_URL )
  if ( Token.gql( "WHERE user = :1", str(request.user) ).get() != None ):
      token = Token.gql( "WHERE user = :1", str(request.user) ).get()
  else:
    token = Token()
  token.user = str(request.user)
  token.fs_request_token = str(request_token)
  token.put()
  auth_url = fs.authorize( request_token, oauth_callback=CALLBACK_URL )
  return redirect( auth_url )
开发者ID:johl,项目名称:FireCheckIn,代码行数:21,代码来源:views.py

示例5: get

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

		try:
			if (username is not None) and (password is not None):

				# Verification du user.
				user = User.query(ndb.AND(User.str_username==username,User.str_password==password)).get()

				if user is None:
					self.error(404)
					return

				# Voir s'il y a deja un token, si oui, on le recréé.
				token = Token.query(Token.key_user==user.key).get()

				if token is not None:
					token.key.delete()

				token = Token(id=GetTimeInt(),
					key_user=user.key,
					b_valide=True)

				token.urlsafe_key = token.key.urlsafe()

				token.put()

				self.response.headers['Content-Type'] = ('text/plain')
				self.response.write(token.key.urlsafe())
				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,代码行数:39,代码来源:escalade_api.py


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