本文整理匯總了Python中constants.Constants.error_token_expired方法的典型用法代碼示例。如果您正苦於以下問題:Python Constants.error_token_expired方法的具體用法?Python Constants.error_token_expired怎麽用?Python Constants.error_token_expired使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類constants.Constants
的用法示例。
在下文中一共展示了Constants.error_token_expired方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: check_user_credentials_with_credentials
# 需要導入模塊: from constants import Constants [as 別名]
# 或者: from constants.Constants import error_token_expired [as 別名]
def check_user_credentials_with_credentials(user_id, token):
# Check token status
status = TokenSerializer.verify_auth_token(token, user_id)
# Is token is expired?
if status == SignatureExpired:
# Yes: return error status
return Constants.error_token_expired()
# Is toke not valid?
elif status == BadSignature:
# Yes: return error status
return Constants.error_token_not_valid()
# Try to find user with received ID
person_model = PersonModel.query.filter_by(person_id=user_id).first()
# Have we user with received ID?
if person_model is None:
# No we haven't: return error status
return Constants.error_no_user_id()
# Is received token correct?
if person_model.token != token:
# No: return error status
return Constants.error_token_not_valid()
# If everything is Ok - return person model
return person_model