def thanks(self, answer, thanks=True):
from .answer import Answer<EOL>if isinstance(answer, Answer) is False:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if answer.author.url == self.url:<EOL><INDENT>return False<EOL><DEDENT>data = {<EOL>'<STR_LIT>': answer.xsrf,<EOL>'<STR_LIT>': answer.aid<EOL>}<EOL>res = self._session.post(Thanks_Url if thanks else Cancel_Thanks_Url,<EOL>data=data)<EOL>return res.json()['<STR_LIT:r>'] == <NUM_LIT:0><EOL>
感谢或取消感谢回答

        :param Answer answer: 要感谢或取消感谢的回答
        :param thanks: True-->感谢，False-->取消感谢
        :return: 成功返回True，失败返回False
        :rtype: bool