PyKitty
This Python SDK allows you to interact with KittySplit to manage expenses in a group. You can fetch a list of users, select a user and add expenses.
Installation
To install the package, use the following command:
pip install pykitty
Usage
- Open a kitty on https://kittysplit.de/ and set a username
- Once opened, copy the full Kittysplit URL, e.g.
https://kittysplit.de/test_kitty/ADLKFJLAKD.../
Create your first expense with the following code (replace <kitty_URL> and <your_username>):
from pykitty import KittySplitAPI
api = KittySplitAPI("<kitty_URL>")
api.select_user("<your_username>")
api.add_expense(
amount="10.00",
description="A warm welcome by pykitty!",
)
Get Users
To fetch a list of users, use the get_users method:
users = api.get_users()
This will return a dictionary with usernames as keys and user IDs as values.
Select User
To select a user, use the select_user method:
api.select_user("username")
This method will set the selected_viewing_party_id attribute to the ID of the specified user.
Add Expense
To add an expense, use the add_expense method:
api.add_expense(
amount="10.00",
description="Lunch",
)
This method will add a new expense with the specified details.
With the entry_date parameter, you can specify the date of the expense:
api.add_expense(
amount="10.00",
description="Lunch",
entry_date="2023-03-29",
)
With the weight_mapping parameter, you can specify how much each user should pay for the expense. The sum of the weights must be 1.
api.add_expense(
amount="10.00",
description="Lunch",
weight_mapping={"username1": 0.6, "username2": 0.4},
)
Get Expenses
api.get_expenses()
License
This project is licensed under the MIT License.
Next Steps (TODO)
- Parse Kitty URL to extract
kitty_id - Implement
get_expensesmethod to retrieve all expenses. - Add support for deleting expenses.
- Enhance test coverage.
- Add support for updating expenses.
- Document CLI usage.
- Support for Kittysplit in other languages.
Metadata
Release files for pykitty 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pykitty-0.3.0.tar.gz | 7.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pykitty-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.9 kB
Release files / pykitty-0.3.0.tar.gz
| Download URL | pykitty-0.3.0.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
869276faa79b2a7741cab14c7c8b1374f3b63ce9008ca2647066ef0a34e5fbdd
|
|
BLAKE2b-256 checksum How to use checksums |
2c41fb24efc6a36ad5f79baeba51de24be2ba023be242effa7a1943fda55a1f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.7.6 Darwin/22.4.0
|
Release files / pykitty-0.3.0-py3-none-any.whl
| Download URL | pykitty-0.3.0-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
08ab60396c81c9841e9ed706e0fb3a57dbe09d4d4135decb7fb039fbb17f6f71
|
|
BLAKE2b-256 checksum How to use checksums |
e6ba12980f6e03988862b5dd43deda4155f8cf0a8f7a990e13441a555d046b90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.7.6 Darwin/22.4.0
|