How to use the splitwise.user.Friend function in splitwise

To help you get started, we’ve selected a few splitwise examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github namaggarwal / splitwise / splitwise / __init__.py View on Github external
e.setMessage("Group with id %d does not exist" % group_id)
            raise
        content = json.loads(content)
        errors = None
        success = False
        user = None
        if 'success' in content:
            success = content["success"]

        if 'errors' in content:
            if len(content['errors']) != 0:
                errors = SplitwiseError(content['errors'])

        if 'user' in content:
            if content['user'] is not None:
                user = Friend(content['user'])

        return success, user, errors
github namaggarwal / splitwise / splitwise / __init__.py View on Github external
def getFriends(self):
        """ Gets the list of users friends.

        Returns:
            :obj:`list` of :obj:`splitwise.user.Friend`: List of Friends
        """
        content = self.__makeRequest(Splitwise.GET_FRIENDS_URL)
        content = json.loads(content)

        friends = []
        if "friends" in content:
            for f in content["friends"]:
                friends.append(Friend(f))

        return friends
github namaggarwal / splitwise / splitwise / group.py View on Github external
if "country_code" in data:
                self.country_code = data["country_code"]
            else:
                self.country_code = None

            self.original_debts = []
            for debt in data["original_debts"]:
                self.original_debts.append(Debt(debt))

            self.simplified_debts = []
            for debt in data["simplified_debts"]:
                self.simplified_debts.append(Debt(debt))

            self.members = []
            for member in data["members"]:
                self.members.append(Friend(member))