def add(self): """收听某个用户""" assertion(not bool(self.self), "you can't follow your self") if self.ismyidol: return # already flollowed else: self._api.friends.add(name=self.name)
def delete(self): """取消收听某个用户""" assertion(not bool(self.self), "you can't unfollow your self") if self.ismyidol: self._api.friends.delete(name=self.name) else: pass
def update(self, **kwargs): assertion(self.self, "you can only update youself's profile") nick = self.nick = kwargs.get('nick', self.nick) sex = self.sex = kwargs.get('sex', self.sex) year = self.birthyear = kwargs.get('year', self.birthyear) month = self.birthmonth = kwargs.get('month', self.birthmonth) day = self.birthday = kwargs.get('day', self.birthday) countrycode = self.countrycode = kwargs.get('countrycode', self.countrycode) provincecode = self.provincecode = kwargs.get('provincecode', self.provincecode) citycode = self.citycode = kwargs.get('citycode', self.citycode) introduction = self.introduction = kwargs.get('introduction', self.introduction) self._api.user.update(nick, sex, year, month, day, countrycode, provincecode, citycode, introduction)
def headimg(self, size=100): assertion(size in [20, 30, 40, 50, 100], 'size must be one of 20 30 40 50 100') return '%s/%s' % (self.head, size)
def pm(self, content, clientip='127.0.0.1', jing=None, wei=None): """发私信""" assertion(not bool(self.self), "you can't pm yourself") return self._api.private.add(self.name, content, clientip, jing, wei)
def deleteblacklist(self): """从黑名单中删除某个用户""" assertion(not bool(self.self), "you can't block yourself") self._api.friends.deleteblacklist(name=self.name)
def addblacklist(self): """添加某个用户到黑名单""" assertion(not bool(self.self), "you can't block yourself") self._api.friends.addblacklist(name=self.name)
def deletespecial(self): """取消特别收听某个用户""" assertion(not bool(self.self), "you can't follow yourself") self._api.friends.deletespecial(name=self.name)