References

This part of the documentation covers all the interfaces of Splitwise.

Main Interface

splitwise has a main class Splitwise. All the functionality is provided via this class.

class splitwise.Splitwise(consumer_key, consumer_secret, access_token=None, oauth2_access_token=None, api_key=None)[source]

The Splitwise class that provides all the functionality.

consumer_key

Consumer Key provided by Splitwise.

Type:str
consumer_secret

Consumer Secret provided by Splitwise.

Type:str
auth

A request.AuthBase object that defines an auth.

Type:requests.AuthBase, optional
Parameters:
  • consumer_key (str) – Consumer Key provided by Spliwise
  • consumer_secret (str) – Consumer Secret provided by Splitwise
  • access_token (dict, optional) – Access Token is a combination of oauth_token and oauth_token_secret
  • oauth2_access_token (dict, optional) – OAuth2 Access Token is a combination of access_token and token_type
  • api_key (str, optional) – API key provided by Splitwise
getOAuth2AuthorizeURL(redirect_uri, state=None)[source]

Provides the Authorize URL for end user’s authentication

Returns:
tuple containing:
auth_url(str): URL that user should be redirected to for authorization

oauth_token_secret(str): Token secret that should be saved to redeem token

Return type:tuple
getAuthorizeURL()[source]

Provides the Authorize URL for end user’s authentication

Returns:
tuple containing:
auth_url(str): URL that user should be redirected to for authorization

oauth_token_secret(str): Token secret that should be saved to redeem token

Return type:tuple
getOAuth2AccessToken(code, redirect_uri)[source]

Provides the OAuth1.0 access token

Parameters:
  • code (str) – code from the query param after redirect
  • redirect_uri (str) – Redirect uri specified while getting code
Returns:

dict containing:

access_token(str): The OAuth 2.0 token

token_type(str): The OAuth 2.0 token type

Return type:

dict

getAccessToken(oauth_token, oauth_token_secret, oauth_verifier)[source]

Provides the OAuth1.0 access token

Parameters:
  • oauth_token (str) – The OAuth 1.0 token got from the redirect URL
  • oauth_token_secret (str) – The OAuth 1.0 token secret got while generating the auth URL
  • oauth_verifier (str) – The OAuth 1.0 token verifier got from the redirect URL
Returns:

dict containing:

oauth_token(str): The OAuth 1.0 token

oauth_token_secret(str): The OAuth 1.0 token secret

Return type:

dict

setAccessToken(access_token)[source]

Sets the OAuth1.0 access token, this should be done to make any authorized calls

Parameters:access_token (dict) –

dict containing

oauth_token(str): The OAuth 1.0 token

oauth_token_secret(str): The OAuth 1.0 token secret

setOAuth2AccessToken(access_token)[source]

Sets the OAuth2.0 access token, this should be done to make any authorized calls

Parameters:access_token (dict) –

dict containing

access_token(str): The OAuth 2.0 token

token_type(str): The OAuth 2.0 token type

getCurrentUser()[source]

Gets the current authorized user’s data

Returns:CurrentUser object containing user data
Return type:splitwise.user.CurrentUser
getUser(id)[source]

Gets the friends user’s data given the ids

Parameters:id (long) – ID of the user whose information is needed
Returns:User object containing user data
Return type:splitwise.user.User
updateUser(user)[source]

Updates the user.

:param splitwise.user.CurrentUser: User object with atleast id set

Returns:
tuple containing:
user(splitwise.user.CurrentUser): Object with User detail

errors(splitwise.error.SplitwiseError): Object representing errors

Return type:tuple
getFriends()[source]

Gets the list of users friends.

Returns:List of Friends
Return type:list of splitwise.user.Friend
getGroups()[source]

Gets the list of groups a user is part of.

Returns:List of Groups
Return type:list of splitwise.group.Group
getCurrencies()[source]

Gets the list of curriencies in Splitwise.

Returns:List of Currency
Return type:list of splitwise.currency.Currency
getCategories()[source]

Gets the list of categories in Splitwise.

Returns:List of Category
Return type:list of splitwise.category.Category
getGroup(id=0)[source]

Gets the detail of particular group a user is part of.

Parameters:id (long, optional) – ID of the group. Default value is 0, and means non-group expenses
Returns:Object representing a group
Return type:splitwise.group.Group
getExpenses(offset=None, limit=None, group_id=None, friend_id=None, dated_after=None, dated_before=None, updated_after=None, updated_before=None, visible=None)[source]

Gets the list of expenses given parameters.

Parameters:
  • offset (int, optional) – Number of expenses to be skipped
  • limit (int, optional) – Number of expenses to be returned
  • group_id (long, optional) – GroupID of the expenses
  • friend_id (long, optional) – ID of the friend for which expenses are required
  • dated_after (str, optional) – ISO 8601 Date time. Return expenses later that this date
  • 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:

List of Expense

Return type:

list of splitwise.expense.Expense

getExpense(id)[source]

Gets the detail of the expense given the expense id.

Parameters:id (long, optional) – ID of the expense.
Returns:Object representing an expense
Return type:splitwise.expense.Expense
createExpense(expense)[source]

Creates a new expense.

Parameters:expense (splitwise.expense.Expense) – Splitwise Expense Object.
Returns:
tuple containing:
expense(splitwise.expense.Expense): Object with Expense detail

errors(splitwise.error.SplitwiseError): Object representing errors

Return type:tuple
updateExpense(expense)[source]

Updates an existing expense.

Parameters:
  • expense (splitwise.expense.Expense) – Splitwise Expense Object.
  • id must be set. Include only the fields that should be updated. null fields are ignored (expense) –
Returns:

tuple containing:

expense(splitwise.expense.Expense): Object with Expense detail

errors(splitwise.error.SplitwiseError): Object representing errors

Return type:

tuple

deleteExpense(id)[source]

Deletes the expense with given id.

Parameters:id (long) – ID of the expense to be deleted.
Returns:
tuple containing:
success(bool): True if group deleted, False otherwise

errors(splitwise.error.SplitwiseError): Object representing errors

Return type:tuple
createGroup(group)[source]

Creates a new Group.

Parameters:group (splitwise.group.Group) – Splitwise Group Object.
Returns:
tuple containing:
group(splitwise.group.Group): Object with Group detail

errors(splitwise.error.SplitwiseError): Object representing errors

Return type:tuple
addUserToGroup(user, group_id)[source]

Adds a user to the group.

Parameters:
Returns:

tuple containing:

success(bool): True if group deleted, False otherwise

user(splitwise.user.Friend): Object representing added user details

errors(splitwise.error.SplitwiseError): Object representing errors

Return type:

tuple

deleteGroup(id)[source]

Deletes the group with given id.

Parameters:id (long) – ID of the group to be deleted.
Returns:
tuple containing:
success(bool): True if group deleted, False otherwise

errors(splitwise.error.SplitwiseError): Object representing errors

Return type:tuple
getComments(expense_id)[source]

Get expense comments.

Parameters:expense_id (long) – Expense Id
Returns:Object representing a comment
Return type:splitwise.comment.Comment
createComment(expense_id, content)[source]

Creates a new comment.

Parameters:
  • expense_id – Expense transaction on which a comment has to be made
  • content (comment) – Content of the comment
Returns:

tuple containing:

comment(splitwise.comment.Comment): Object with Comment detail

errors(splitwise.error.SplitwiseError): Object representing errors

Return type:

tuple

getNotifications(updated_since=None, limit=None)[source]

Get notifications.

Parameters:
  • updated_since (string) – Optional. ISO8601 Timestamp.
  • limit (long) – Optional. Defaults to 0
Returns:

Object representing Notifications

Return type:

splitwise.notification.Notifications

Modals

There are several modal objects in this SDK

User

class splitwise.user.User(data=None)[source]

Contains basic user data.

id

ID of the user

Type:long, optional
first_name

First name of the user

Type:str, optional
last_name

Last name of the user

Type:str, optional
email

Email of the user

Type:str, optional
registration_status

Registration status of the user

Type:str, optional
picture

Profile picture of the user

Type:splitwise.picture.Picture, optional
Parameters:data (json, optional) – JSON object representing user object
getId()[source]

Returns id of the user

Returns:ID of the user
Return type:long
getFirstName()[source]

Returns first name of the user

Returns:First name of the user
Return type:str
getLastName()[source]

Returns last name of the user

Returns:Last name of the user
Return type:str
getEmail()[source]

Returns email of the user

Returns:Email of the user
Return type:str
getRegistrationStatus()[source]

Returns registration status of the user

Returns:Registration status of the user
Return type:str
getPicture()[source]

Returns profile picture of the user

Returns:Picture of the user
Return type:splitwise.picture.Picture
setFirstName(first_name)[source]

Sets the first name of the user

Agrs:
first_name(str): First name of the user
setLastName(last_name)[source]

Sets the last name of the user

Agrs:
last_name(str): Last name of the user
setEmail(email)[source]

Sets the email of the user

Agrs:
email(str): Email of the user
setId(id)[source]

Sets the id of the user

Agrs:
id(long): ID of the user
class splitwise.user.CurrentUser(data=None)[source]

Represents the current logged in user.

Inherits: splitwise.user.User

default_currency

Default Currency

Type:str, optional
locale

Locale

Type:str, optional
date_format

Date format used by the user

Type:str, optional
default_group_id

User’s default group id

Type:long, optional
Parameters:data (json, optional) – JSON object representing current user object
getDefaultCurrency()[source]

Returns default currency of the user

Returns:Default currency of the user
Return type:str
getLocale()[source]

Returns locale of the user

Returns:locale of the user
Return type:str
getDateFormat()[source]

Returns Date format used by the user

Returns:Date format used by the user
Return type:str
getDefaultGroupId()[source]

Returns default group id the user

Returns:default group id the user
Return type:long
class splitwise.user.Friend(data=None)[source]

Represents a friend user.

Inherits: splitwise.user.User

balances

List of balances

Type:list of splitwise.balance.Balance, optional
groups

List of groups

Type:list of splitwise.group.FriendGroup, optional
updated_at

ISO 8601 Date time. The last updated date time of user

Type:str, optional
Parameters:data (json, optional) – JSON object representing friend user object
getUpdatedAt()[source]

Returns last updated date of the user

Returns:last updated date of the user
Return type:str
getBalances()[source]

Returns balances of the user

Returns:List of balances
Return type:list of splitwise.balance.Balance
getGroups()[source]

Returns balances of the user

Returns:List of groups
Return type:list of splitwise.group.Group
class splitwise.user.ExpenseUser(data=None)[source]

Represents a user in an expense.

Inherits: splitwise.user.User

paid_share

Paid share for the expense

Type:str, optional
owed_share

Owed share for the expense

Type:str, optional
net_balance

Net balance for the expense

Type:str, optional
Parameters:data (json, optional) – JSON object representing user object
getPaidShare()[source]

Returns paid share of the user

Returns:paid share of the user
Return type:str
getOwedShare()[source]

Returns owed share of the user

Returns:owed share of the user
Return type:str
getNetBalance()[source]

Returns net balance of the user

Returns:net balance of the user
Return type:str
setPaidShare(paid_share)[source]

Sets the paid share of the user

Parameters:paid_share (str) – Paid share share of the user
setOwedShare(owed_share)[source]

Sets the owed share of the user

Parameters:owed_share (str) – Owed share share of the user

Group

class splitwise.group.Group(data=None)[source]

Represents a splitwise group.

id

ID of the group

Type:long, optional
name

Name of the group

Type:str, optional
updated_at

ISO 8601 Date time. The last updated date time of group

Type:str, optional
created_at

ISO 8601 Date time. The created date time of group

Type:str, optional
simplify_by_default

Is Simplified expenses by default

Type:bool, optional
group_type

Type of the group

Type:str, optional
whiteboard

Whiteboard of the group

Type:str, optional

Invitation link of the group

Type:str, optional
country_code

Country of the group

Type:str, optional
original_debts

List of original debts

Type:list of splitwise.debt.Debt, optional
simplfied_debts

List of simplfied debts

Type:list of splitwise.debt.Debt, optional
members

List of members of the group

Type:list of splitwise.user.Friend, optional
Parameters:data (json, optional) – JSON object representing group object
getId()[source]

Returns the id of the group

Returns:ID of the group
Return type:long
getName()[source]

Returns the name of the group

Returns:name of the group
Return type:str
getCreatedAt()[source]

Returns the ISO 8601 create date time of the group

Returns:ISO 8601 create date time of the group
Return type:str
getUpdatedAt()[source]

Returns the ISO 8601 update date time of the group

Returns:ISO 8601 update date time of the group
Return type:str
getWhiteBoard()[source]

Returns the whiteboard of the group

Returns:whiteboard of the group
Return type:str
isSimplifiedByDefault()[source]

Returns if simplified by default

Returns:simplified by default
Return type:bool
getMembers()[source]

Returns the list of group members

Returns:List of members of the group
Return type:list of splitwise.user.Friend
getOriginalDebts()[source]

Returns the list of original debts

Returns:List of original debt of the group
Return type:list of splitwise.debt.Debt
getType()[source]

Returns the type of the group

Returns:type of the group
Return type:str
getGroupType()[source]

Returns the type of the group

Returns:type of the group
Return type:str
getSimplifiedDebts()[source]

Returns the list of simplified debts

Returns:List of simplified debt of the group
Return type:list of splitwise.debt.Debt

Returns the invitation link of the group

Returns:invitation link of the group
Return type:str
setName(name)[source]

Sets the name of the group

Parameters:name (str) – name of the group
setType(group_type)[source]

Sets the type of the group

Parameters:group_type (str) – type of the group
setGroupType(group_type)[source]

Sets the type of the group

Parameters:group_type (str) – type of the group
setWhiteBoard(whiteboard)[source]

Sets the whiteboard of the group

Parameters:whiteboard (str) – whiteboard of the group
setCountryCode(country_code)[source]

Sets the country code of the group

Parameters:country_code (str) – country code of the group
setMembers(members)[source]

Sets the members of the group

Parameters:members (list of splitwise.user.Friend) – list of members of the group
addMember(member)[source]

Adds a member to the group

Parameters:member (splitwise.user.Friend) – members of the group
class splitwise.group.FriendGroup(data=None)[source]

Simplified Group while representing a Friend.

id

ID of the group

Type:long, optional
balances

List of balances of the group

Type:list of splitwise.balance.Balance, optional
Parameters:data (json, optional) – JSON object representing group
setId(id)[source]

Sets the id of the group

Parameters:id (long) – ID of the group
getId()[source]

Returns the id of the group

Returns:ID of the group
Return type:long
getBalances()[source]

Returns the balances of the group

Returns:Balances of the group
Return type:list of splitwise.balance.Balance

Expense

class splitwise.expense.Expense(data=None)[source]

Expense in Splitwise

id

ID of the expense

Type:long, optional
group_id

GroupID of the expense

Type:long, optional
description

Description of the expense

Type:str, optional
repeats

True if expense repeats, false otherwise

Type:bool, optional
repeat_interval

Repeat interval of the expense

Type:str, optional
email_reminder

True if email reminder is set, false otherwise

Type:bool, optional
email_reminder_in_advance

Days of email reminder

Type:int, optional
next_repeat

Date of next repeat

Type:str, optional
details

Additional details of the expense

Type:str, optional
comments_count

Comment count of the expense

Type:int, optional
payment

Is payment done

Type:bool, optional
creation_method

Creation method

Type:str, optional
transaction_method

Transaction method

Type:str, optional
transaction_confirmed

Is Transaction confirmed or not

Type:bool, optional
cost

Amount of the expense

Type:str, optional
currency_code

Currency code of the expense

Type:str, optional
created_by

User who created the expense

Type:splitwise.user.User, optional
date

Date of the expense

Type:str, optional
created_at

Creation date of the expense

Type:str, optional
updated_at

Last updation date of the expense

Type:str, optional
deleted_at

Deletion date of the expense

Type:str, optional
receipt

Receipt of the expense

Type:splitwise.receipt.Receipt, optional
category

Category of the expense

Type:splitwise.category.Category, optional
updated_by

User who updated the expense

Type:splitwise.user.User, optional
deleted_by

User who deleted the expense

Type:splitwise.user.User, optional
friendship_id

Friendship id of the users in expense

Type:long, optional
expense_bundle_id

Expense bundle id of the expense

Type:long, optional
repayments

List of repayments expressed as Debt

Type:list of splitwise.debt.Debt, optional
user

List of users with balances

Type:list of splitwise.user.ExpenseUser, optional
transaction_id

Transaction id of the expense

Type:long, optional
Parameters:data (json, optional) – JSON object representing expense
getId()[source]

Returns the ID of the expense

Returns:ID of the expense
Return type:long
getGroupId()[source]

Returns the GroupID of the expense

Returns:GroupID of the expense
Return type:long
getDescription()[source]

Returns the Description of the expense

Returns:Description of the expense
Return type:str
isRepeat()[source]

Returns if expense repeats

Returns:True if expense repeats, False otherwise
Return type:bool
getRepeatInterval()[source]

Returns the repeat interval of the expense

Returns:Repeat interval of expense
Return type:str
getEmailReminder()[source]

Returns if email reminder is set

Returns:True if email reminder is set, False otherwise
Return type:bool
getEmailReminderInAdvance()[source]

Returns the email reminder in advance of the expense

Returns:email reminder in advance of expense
Return type:int
getNextRepeat()[source]

Returns the next repeat of the expense

Returns:next repeat of expense
Return type:str
getDetails()[source]

Returns the details of the expense

Returns:details of expense
Return type:str
getCommentsCount()[source]

Returns the comment count of the expense

Returns:comment count of expense
Return type:int
getPayment()[source]

Returns if payment is done in expense

Returns:True if payment done, False otherwise
Return type:bool
getCreationMethod()[source]

Returns the creation method of the expense

Returns:creation method of expense
Return type:str
getTransactionMethod()[source]

Returns the transaction method of the expense

Returns:transaction method of expense
Return type:str
getTransactionConfirmed()[source]

Returns if transaction is confirmed in expense

Returns:True if transaction confirmed, False otherwise
Return type:bool
getCost()[source]

Returns the amount of the expense

Returns:amount of expense
Return type:str
getCurrencyCode()[source]

Returns the currency code of the expense

Returns:currency code of expense
Return type:str
getCreatedBy()[source]

Returns the user who created the expense

Returns:User who created the expense
Return type:splitwise.user.User
getDate()[source]

Returns the date of the expense

Returns:date of expense
Return type:str
getCreatedAt()[source]

Returns the created at date of the expense

Returns:created at date of expense
Return type:str
getUpdatedAt()[source]

Returns the updated at date of the expense

Returns:updated at date of expense
Return type:str
getDeletedAt()[source]

Returns the deleted at date of the expense

Returns:deleted at date of expense
Return type:str
getReceipt()[source]

Returns the receipt of the expense

Returns:receipt of the expense
Return type:splitwise.receipt.Receipt
getCategory()[source]

Returns the category of the expense

Returns:category of the expense
Return type:splitwise.category.Category
getUpdatedBy()[source]

Returns the user who updated the expense

Returns:User who updated the expense
Return type:splitwise.user.User
getDeletedBy()[source]

Returns the user who deleted the expense

Returns:User who deleted the expense
Return type:splitwise.user.User
getUsers()[source]

Returns the list of users in the expense along with balance

Returns:list of users in the expense along with balance
Return type:list of splitwise.user.ExpenseUser
getExpenseBundleId()[source]

Returns the expense bundle id of the expense

Returns:expense bundle id of expense
Return type:long
getFriendshipId()[source]

Returns the friendship id of the expense

Returns:friendship id of expense
Return type:long
getRepayments()[source]

Returns the list of repayments

Returns:list of debts
Return type:list of splitwise.debt.Debt
getReceiptPath()[source]

Returns the receipt of the expense

Returns:path to the receipt file
Return type:string
getTransactionId()[source]

Returns the transaction id of the expense

Returns:Transaction ID of the expense
Return type:long
setId(id)[source]

Sets the id of the expense

Parameters:id (long) – ID of the expense
setGroupId(id)[source]

Sets the group id of the expense

Parameters:id (long) – Group ID of the expense
setDescription(desc)[source]

Sets the description of the expense

Parameters:desc (str) – description of the expense
setPayment(payment)[source]

Sets the payment of the expense

Parameters:payment (bool) – payment of the expense
setCost(cost)[source]

Sets the cost of the expense

Parameters:cost (str) – cost of the expense
setFriendshipId(f_id)[source]

Sets the friendship id of the expense

Parameters:f_id (long) – friendship id of the expense
setCreationMethod(creation_method)[source]

Sets the creation method of the expense

Parameters:creation_method (str) – creation method of the expense
setDate(date)[source]

Sets the date of the expense

Parameters:date (str) – date of the expense
setRepeatInterval(repeat_interval)[source]

Sets to repeat the interval of expense

Parameters:repeat_interval (str) – repeat interval of the expense
setCurrencyCode(currency_code)[source]

Sets the currency code of the expense

Parameters:currency_code (str) – currency code of the expense
setCategory(category)[source]

Sets to category of the expense

Parameters:category (splitwise.category.Category) – category of the expense
setUsers(users)[source]

Sets to users of the expense

Parameters:users (list of splitwise.user.ExpenseUser) – List of users
addUser(user)[source]

Add a user to the expense

Parameters:user (splitwise.user.ExpenseUser) – user to add to expense
setSplitEqually(should_split=True)[source]

Set if expense should be split equally. Note that group_id should be set to use this

Parameters:should_split (bool, optional) – Should the expense be split equally. Default value is True
setReceipt(receipt)[source]

Sets the receipt of the expense

Parameters:receipt (string) – path to the receipt file
setDetails(details)[source]

Sets the details of the expense

Returns:details of the expense
Return type:details(string)

Balance

class splitwise.balance.Balance(data=None)[source]

Balance of an expense/group.

currency_code

Currency code of the balance

Type:str
amount

Amount of the balance

Type:str
Parameters:data (json, optional) – JSON object representing balance
getCurrencyCode()[source]

Returns the currency code of the balance

Returns:Currency code of the balance
Return type:str
getAmount()[source]

Returns the amount of the balance

Returns:Amount of the balance
Return type:str

Debt

class splitwise.debt.Debt(data=None)[source]

Debt of an expense/group.

from

UserID of the user who paid

Type:long
to

UserID of the user who owes

Type:long
amount

Amount of the debt

Type:str
currency_code

Currency code of the debt

Type:str, optional
Parameters:data (json, optional) – JSON object representing debt
getFromUser()[source]

Returns the from user in the debt

Returns:From user in the debt
Return type:long
getToUser()[source]

Returns the to user in the debt

Returns:To user in the debt
Return type:long
getAmount()[source]

Returns the amount in the debt

Returns:Amount in the debt
Return type:long
getCurrencyCode()[source]

Returns the currency code in the debt

Returns:Currency code in the debt
Return type:long

Picture

class splitwise.picture.Picture(data=None)[source]

Profile picture of the user.

small

Link to small size picture

Type:str, optional
medium

Link to medium size picture

Type:str, optional
large

Link to large size picture

Type:str, optional
Parameters:data (json, optional) – JSON object representing picture object
getSmall()[source]

Returns the link to small size picture of the user

Returns:Link to small size picture of the user
Return type:str
getMedium()[source]

Returns the link to medium size picture of the user

Returns:Link to medium size picture of the user
Return type:str
getLarge()[source]

Returns the link to large size picture of the user

Returns:Link to large size picture of the user
Return type:str

Receipt

class splitwise.receipt.Receipt(data)[source]

Receipt of an expense.

original

Link to original receipt

Type:str
large

Link to large size receipt

Type:str
getOriginal()[source]

Returns the link to original size picture of the receipt

Returns:Link to original size picture of the receipt
Return type:str
getLarge()[source]

Returns the link to large size picture of the receipt

Returns:Link to large size picture of the receipt
Return type:str

Category

class splitwise.category.Category(data=None)[source]

Category in splitwise.

id

ID of the category

Type:long
name

Name of the category

Type:str
subcategories

Subcategories of this category

Type:list of splitwise.category.Category
Parameters:data (json, optional) – JSON object representing category object
getId()[source]

Returns the id of the category

Returns:ID of the category
Return type:long
getName()[source]

Returns the name of the category

Returns:name of the category
Return type:str
getSubcategories()[source]

Returns the list of sub categories for the category

Returns:List of sub categories
Return type:list of splitwise.category.Category
setId(id)[source]

Returns the id of the category

Returns:id of the category
Return type:long

Currency

class splitwise.currency.Currency(data=None)[source]

Currency in splitwise.

code

Code of the currency

Type:str
unit

Unit of the currency

Type:str
Parameters:data (json, optional) – JSON object representing currency object
getCode()[source]

Returns the code of the currency

Returns:code of the currency
Return type:str
getUnit()[source]

Returns the unit of the currency

Returns:unit of the currency
Return type:str

Comment

class splitwise.comment.Comment(data=None)[source]

Contains comments made on an expense

id

Comment Id

Type:long
content

Comment posted

Type:string
comment_type

User

Type:string
relation_type

ExpenseComment

Type:string
relation_id

Expense Id

Type:long
created_at

Comment creation datetime

Type:datetime
deleted_at

Comment deletion datetime

Type:datetime, optional
user

Author of the comment

Parameters:data (json, optional) – JSON object representing comment object
getId()[source]

Returns comment’s Id

Returns:Comment’s Id
Return type:str
getContent()[source]

Returns comment message

Returns:Content of the comment
Return type:str
getCommentType()[source]

Returns comment type

Returns:Comment type
Return type:str
getRelationType()[source]

Returns relation type of the comment

Returns:Relation type of the comment
Return type:str
getRelationId()[source]

Returns relation id

Returns:Relation Id
Return type:str
getCreatedAt()[source]

Returns datetime at which comment was created

Returns:Comment’s creation date
Return type:datetime
getDeletedAt()[source]

Returns datetime at which comment was deleted

Returns:Comment’s deletion date
Return type:datetime
getCommentedUser()[source]

Returns commented user’s details

Returns:Commented user object
Return type:splitwise.user.User

Errors

class splitwise.error.SplitwiseError(data=None)[source]

Splitwise Error encapsulates the error.

errors

JSON object representing error

Type:json
Parameters:data (json, optional) – JSON object representing errors
getErrors()[source]

Returns the json errors object

Returns:JSON error object
Return type:json

Exceptions

SplitwiseBaseException

class splitwise.exception.SplitwiseBaseException(message=None, http_body=None, http_status=None, http_headers=None)[source]

Base exception class for splitwise.

message

Exception message

Type:str, optional
http_body

HTTP body

Type:str, optional
http_status

HTTP status code

Type:int, optional
http_headers

Dict containing header key and value

Type:dict, optional
errors

JSON errors

Type:json, optional
Parameters:
  • message (str, optional) – Exception message
  • http_body (str, optional) – HTTP body
  • http_status (int, optional) – HTTP status code
  • http_headers (dict, optional) – Dict containing header key and value
setMessage(message)[source]

Sets the exception message :param message: Exception message :type message: str

SplitwiseException

class splitwise.exception.SplitwiseException(message, response=None)[source]

Exception based on requests library Response.

Inherits: splitwise.exception.SplitwiseBaseException

Exception based on requests library Response.

Parameters:
  • message (str) – Exception message
  • response (requests.Response, optional) – response object from requests library

SplitwiseUnauthorizedException

class splitwise.exception.SplitwiseUnauthorizedException(message, response=None)[source]

Exception when request to splitwise is unauthorized

Inherits: splitwise.exception.SplitwiseException

Exception based on requests library Response.

Parameters:
  • message (str) – Exception message
  • response (requests.Response, optional) – response object from requests library

SplitwiseNotAllowedException

class splitwise.exception.SplitwiseNotAllowedException(message, response=None)[source]

Exception when request to splitwise is not allowed

Inherits: splitwise.exception.SplitwiseException

Exception based on requests library Response.

Parameters:
  • message (str) – Exception message
  • response (requests.Response, optional) – response object from requests library

SplitwiseNotFoundException

class splitwise.exception.SplitwiseNotFoundException(message, response=None)[source]

Exception when request to splitwise returns not found

Inherits: splitwise.exception.SplitwiseBaseException

Exception based on requests library Response.

Parameters:
  • message (str) – Exception message
  • response (requests.Response, optional) – response object from requests library