def get_myrelation(): db.add_queue(UID) fans = [] for fan in weibo.get_myfans(UID): fans.append(fan['uid']) db.add_user(fan['uid'], fan['nickname'], fan['sex'], fan['address'], fan['info'], fan['face']) db.add_relation(UID, fan['uid']) follow = [] for fo in weibo.get_myfollow(UID): follow.append(fo['uid']) db.add_user(fo['uid'], fo['nickname'], fo['sex'], fo['address'], fo['info'], fo['face']) db.add_relation(fo['uid'], UID) for friend in get_friends(fans, follow): db.add_queue(friend) db.finish_queue(UID)
def get_relation(uid): fans = [] for fan in weibo.get_hisfans(uid): fans.append(fan['uid']) print('User[%s] fan[%s]'%(uid, fan['uid'])) db.add_user(fan['uid'], fan['nickname'], fan['sex'], fan['address'], fan['info'], fan['face']) db.add_relation(uid, fan['uid']) follow = [] for fo in weibo.get_hisfollow(uid): follow.append(fo['uid']) print('User[%s] follow[%s]'%(uid, fo['uid'])) db.add_user(fo['uid'], fo['nickname'], fo['sex'], fo['address'], fo['info'], fo['face']) db.add_relation(fo['uid'], uid) for friend in get_friends(fans, follow): db.add_queue(friend) print('User[%s] fans[%s] follow[%s]'%(uid, len(fans), len(follow))) db.finish_queue(uid)
def get_relation(uid): fans = [] for fan in weibo.get_hisfans(uid): fans.append(fan['uid']) print('User[%s] fan[%s]' % (uid, fan['uid'])) db.add_user(fan['uid'], fan['nickname'], fan['sex'], fan['address'], fan['info'], fan['face']) db.add_relation(uid, fan['uid']) follow = [] for fo in weibo.get_hisfollow(uid): follow.append(fo['uid']) print('User[%s] follow[%s]' % (uid, fo['uid'])) db.add_user(fo['uid'], fo['nickname'], fo['sex'], fo['address'], fo['info'], fo['face']) db.add_relation(fo['uid'], uid) for friend in get_friends(fans, follow): db.add_queue(friend) print('User[%s] fans[%s] follow[%s]' % (uid, len(fans), len(follow))) db.finish_queue(uid)