The unofficial Kittysplit wrapper for Python.
Project description
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pykitty-0.3.0.tar.gz.
File metadata
- Download URL: pykitty-0.3.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.7.6 Darwin/22.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
869276faa79b2a7741cab14c7c8b1374f3b63ce9008ca2647066ef0a34e5fbdd
|
|
| MD5 |
f2c8d36504a0fd169f191267f86618d6
|
|
| BLAKE2b-256 |
2c41fb24efc6a36ad5f79baeba51de24be2ba023be242effa7a1943fda55a1f5
|
File details
Details for the file pykitty-0.3.0-py3-none-any.whl.
File metadata
- Download URL: pykitty-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.7.6 Darwin/22.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08ab60396c81c9841e9ed706e0fb3a57dbe09d4d4135decb7fb039fbb17f6f71
|
|
| MD5 |
31be4439a64a31795aaf5ee6c297bf16
|
|
| BLAKE2b-256 |
e6ba12980f6e03988862b5dd43deda4155f8cf0a8f7a990e13441a555d046b90
|