    def get_avatar(self, save_path=None):
        """
        获取头像

        :param save_path: 保存路径(后缀通常为.jpg)，若为 `None` 则返回字节数据
        """

        logger.info('getting avatar of {}'.format(self))

        from .group import Group
        from .member import Member
        from .friend import User

        if isinstance(self, Group):
            kwargs = dict(userName=None, chatroomUserName=self.user_name)
        elif isinstance(self, Member):
            kwargs = dict(userName=self.user_name, chatroomUserName=self.group.user_name)
        elif isinstance(self, User):
            kwargs = dict(userName=self.user_name, chatroomUserName=None)
        else:
            raise TypeError('expected `Chat`, got`{}`'.format(type(self)))

        kwargs.update(dict(picDir=save_path))

        return self.bot.core.get_head_img(**kwargs)
获取头像

:param save_path: 保存路径(后缀通常为.jpg)，若为 `None` 则返回字节数据
wxpy/api/chats/chat.py