Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if category:
expense_data["category_id"] = category.getId()
content = self.__makeRequest(
Splitwise.CREATE_EXPENSE_URL, "POST", expense_data)
content = json.loads(content)
expense = None
errors = None
if 'expenses' in content:
if len(content['expenses']) > 0:
expense = Expense(content["expenses"][0])
if 'errors' in content:
if len(content['errors']) != 0:
errors = SplitwiseError(content['errors'])
return expense, errors
if "members" in group_info:
group_members = group.getMembers()
del group_info["members"]
Splitwise.setUserArray(group_members, group_info)
content = self.__makeRequest(
Splitwise.CREATE_GROUP_URL, "POST", group_info)
content = json.loads(content)
group_detail = None
errors = None
if "group" in content:
group_detail = Group(content["group"])
if "errors" in content["group"]:
if len(content["group"]['errors']) != 0:
errors = SplitwiseError(content["group"]["errors"])
return group_detail, errors
except SplitwiseNotAllowedException as e:
e.setMessage("You are not allowed to access group with id %d" % group_id)
raise
except SplitwiseNotFoundException as e:
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
content = self.__makeRequest(
Splitwise.DELETE_GROUP_URL+"/"+str(id), "POST")
except SplitwiseNotAllowedException as e:
e.setMessage("You are not allowed to access group with id %d" % id)
raise
except SplitwiseNotFoundException as e:
e.setMessage("Group with id %d does not exist" % id)
raise
content = json.loads(content)
if 'success' in content:
success = content["success"]
if 'errors' in content:
if len(content['errors']) != 0:
errors = SplitwiseError(content['errors'])
return success, errors