def get_token_update_esipy(self, character_id, scope): """ get token, update it and return everything Get the token using what have been given in parameter then try to update esisecurity, verify the token is up to date and catch any APIException while updating it to be able to invalidate wrong tokens. """ token = TokenScope.query.filter(TokenScope.user_id == character_id, TokenScope.scope == scope).one() esisecurity.update_token(token.get_sso_data()) if esisecurity.is_token_expired(): token.update_token(esisecurity.refresh()) try: db.session.commit() except SQLAlchemyError: db.session.rollback() return token
def get_token_update_esipy(character_id, scope): """ get token, update it and return everything Get the token using what have been given in parameter then try to update esisecurity, verify the token is up to date and catch any APIException while updating it to be able to invalidate wrong tokens. """ token = TokenScope.query.filter(TokenScope.user_id == character_id, TokenScope.scope == scope).one() esisecurity.update_token(token.get_sso_data()) if esisecurity.is_token_expired(): try: token.update_token(esisecurity.refresh()) db.session.commit() except APIException as e: inc_fail_token_scope(token, e.status_code) raise return token
def get_token_update_esipy(self, character_id, scope): """ get token, update it and return everything Get the token using what have been given in parameter then try to update esisecurity, verify the token is up to date and catch any APIException while updating it to be able to invalidate wrong tokens. """ token = TokenScope.query.filter( TokenScope.user_id == character_id, TokenScope.scope == scope ).one() esisecurity.update_token(token.get_sso_data()) if esisecurity.is_token_expired(): try: token.update_token(esisecurity.refresh()) db.session.commit() except APIException as e: self.inc_fail_token_scope(token, e.status_code) raise return token