Skip to content

Commit

Permalink
Merge pull request #92 from namaggarwal/get_expenses_visible
Browse files Browse the repository at this point in the history
Get expenses visible
  • Loading branch information
namaggarwal authored Jun 19, 2023
2 parents a653ca5 + 3f8ee42 commit d8888d3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ sObj.getGroup(43233)

### Get Expenses

You can use ```getExpenses(offset,limit,group_id,friend_id,dated_after,dated_before,updated_after,updated_before)``` to get all the expenses of the current user based on filter options. It returns a list of ```Expense``` objects.
You can use ```getExpenses(offset,limit,group_id,friend_id,dated_after,dated_before,updated_after,updated_before,visible)``` to get all the expenses of the current user based on filter options. It returns a list of ```Expense``` objects.

```python
sObj = Splitwise(Config.consumer_key,Config.consumer_secret)
Expand Down
11 changes: 8 additions & 3 deletions splitwise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,8 @@ def getExpenses(self,
dated_after=None,
dated_before=None,
updated_after=None,
updated_before=None
updated_before=None,
visible=None
):
""" Gets the list of expenses given parameters.
Expand All @@ -486,6 +487,7 @@ def getExpenses(self,
dated_before(str, optional): ISO 8601 Date time. Return expenses earlier than this date
updated_after(str, optional): ISO 8601 Date time. Return expenses updated after this date
updated_before(str, optional): ISO 8601 Date time. Return expenses updated before this date
visible(bool, optional): Boolean to show only not deleted expenses
Returns:
:obj:`list` of :obj:`splitwise.expense.Expense`: List of Expense
Expand All @@ -500,7 +502,10 @@ def getExpenses(self,
params = localCopy.keys()
for param in params:
if param != 'self' and param != 'options' and localCopy.get(param) is not None:
options[param] = localCopy.get(param)
paramVal = localCopy.get(param)
options[param] = paramVal
if isinstance(paramVal, bool):
options[param] = str(paramVal).lower()

url = Splitwise.GET_EXPENSES_URL

Expand Down Expand Up @@ -654,7 +659,7 @@ def updateExpense(self, expense):
if 'expenses' in content:
if len(content['expenses']) > 0:
expense = Expense(content["expenses"][0])
print(content)

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

0 comments on commit d8888d3

Please sign in to comment.