def get_user_id(nickname): result = json.loads(plurk.callAPI('/Profile/getPublicProfile', user_id=nickname).read()) if 'user_info' in result.keys(): return result['user_info']['uid'] else: return False
def get_user_id(nickname): result = json.loads( plurk.callAPI('/Profile/getPublicProfile', user_id=nickname).read()) if 'user_info' in result.keys(): return result['user_info']['uid'] else: return False
def are_friends(userA, userB): url = '/FriendsFans/getFriendsByOffset' uid_A = get_user_id(userA) uid_B = get_user_id(userB) if uid_A and uid_B: friends = json.loads(plurk.callAPI(url,user_id=uid_A,limit=5000).read()) else: return False for friend in friends: if uid_B == friend['uid']: return True return False
def are_friends(userA, userB): url = '/FriendsFans/getFriendsByOffset' uid_A = get_user_id(userA) uid_B = get_user_id(userB) if uid_A and uid_B: friends = json.loads( plurk.callAPI(url, user_id=uid_A, limit=5000).read()) else: return False for friend in friends: if uid_B == friend['uid']: return True return False