Skip to main content

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

  1. Open a kitty on https://kittysplit.de/ and set a username
  2. 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_expenses method to retrieve all expenses.
  • Add support for updating and deleting 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

pykitty-0.2.2.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pykitty-0.2.2-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file pykitty-0.2.2.tar.gz.

File metadata

  • Download URL: pykitty-0.2.2.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.7.6 Darwin/22.4.0

File hashes

Hashes for pykitty-0.2.2.tar.gz
Algorithm Hash digest
SHA256 a92de8551402685386ca62a8d027abdab8516ac1c76ddb4c98378e259789c49d
MD5 a70750f0e0fd5fbb96df4cd42c533556
BLAKE2b-256 77c3c46090826cd55d85819e5225d96d7104932424cadcb5424db2aff595d0eb

See more details on using hashes here.

File details

Details for the file pykitty-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: pykitty-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 7.4 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

Hashes for pykitty-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a3061c434ab77b50088d033ab729fa2a9e6c5d73e796b39579c1767e2c7dd1ea
MD5 35ba96557210f5f2682e399dc3126f89
BLAKE2b-256 7ac4bc0e0c3a3c4cfa577fc0368c2ba61023b10e59b1a76075bf5b851c6fe970

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page