def get_friend_ids_v09(self, user_id): myspace = MySpace(MYSPACE_CONSUMER_KEY, MYSPACE_CONSUMER_SECRET) moreFriends = True page_size = 50 max_friends = 1000 start_index = 1 friend_ids = [] find_id = re.compile("\d+$") while moreFriends: person_id = 'myspace.com.person.%s' % user_id friends = myspace.get_friends_v09(person_id=person_id, get_friends=True, start_index=start_index, count=page_size) for friend in friends['entry']: person = friend['person'] match = re.search(find_id, person['id']) friend_id = int(match.group(0)) friend_ids.append(friend_id) if len(friends['entry']) < page_size or len( friend_ids) > max_friends: moreFriends = False start_index += page_size friend_ids = friend_ids[:max_friends] return friend_ids
def get_friends_v08(self, user_id): ''' hasApp returns only when true ''' myspace = MySpace(MYSPACE_CONSUMER_KEY, MYSPACE_CONSUMER_SECRET) moreFriends = True page = 1 page_size = 50 max_friends = 1000 friends = [] while moreFriends: users = myspace.get_friends(user_id, page, page_size) #list='app' for friend in users['Friends']: friends.append(int(friend['userId'])) if len(users['Friends']) < page_size or len(friends) > max_friends: moreFriends = False page += 1 friends = friends[:max_friends] return users
def get_profile_extended(self, user_id): myspace = MySpace(MYSPACE_CONSUMER_KEY, MYSPACE_CONSUMER_SECRET) profile = myspace.get_profile_extended(user_id) return profile