Skip to content

Commit d8888d3

Browse files
authored
Merge pull request #92 from namaggarwal/get_expenses_visible
Get expenses visible
2 parents a653ca5 + 3f8ee42 commit d8888d3

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ sObj.getGroup(43233)
192192

193193
### Get Expenses
194194

195-
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.
195+
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.
196196

197197
```python
198198
sObj = Splitwise(Config.consumer_key,Config.consumer_secret)

splitwise/__init__.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,8 @@ def getExpenses(self,
473473
dated_after=None,
474474
dated_before=None,
475475
updated_after=None,
476-
updated_before=None
476+
updated_before=None,
477+
visible=None
477478
):
478479
""" Gets the list of expenses given parameters.
479480
@@ -486,6 +487,7 @@ def getExpenses(self,
486487
dated_before(str, optional): ISO 8601 Date time. Return expenses earlier than this date
487488
updated_after(str, optional): ISO 8601 Date time. Return expenses updated after this date
488489
updated_before(str, optional): ISO 8601 Date time. Return expenses updated before this date
490+
visible(bool, optional): Boolean to show only not deleted expenses
489491
490492
Returns:
491493
:obj:`list` of :obj:`splitwise.expense.Expense`: List of Expense
@@ -500,7 +502,10 @@ def getExpenses(self,
500502
params = localCopy.keys()
501503
for param in params:
502504
if param != 'self' and param != 'options' and localCopy.get(param) is not None:
503-
options[param] = localCopy.get(param)
505+
paramVal = localCopy.get(param)
506+
options[param] = paramVal
507+
if isinstance(paramVal, bool):
508+
options[param] = str(paramVal).lower()
504509

505510
url = Splitwise.GET_EXPENSES_URL
506511

@@ -654,7 +659,7 @@ def updateExpense(self, expense):
654659
if 'expenses' in content:
655660
if len(content['expenses']) > 0:
656661
expense = Expense(content["expenses"][0])
657-
print(content)
662+
658663
if 'errors' in content:
659664
if len(content['errors']) != 0:
660665
errors = SplitwiseError(content['errors'])

0 commit comments

Comments
 (0)