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 parser 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.1.tar.gz (5.2 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.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pykitty-0.2.1.tar.gz
Algorithm Hash digest
SHA256 fefce86ce68ef048583c86a515d267aebb8e8c9d4b34c2a4f21d061a4ec9f5ce
MD5 3deedc9e547d8bedbf7b26eac45ac1c1
BLAKE2b-256 36cbfda2c9a03ff60414db3036aa2e344fbc059fe0b1921a870077a81d9acfd9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pykitty-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.1 CPython/3.7.6 Darwin/22.4.0

File hashes

Hashes for pykitty-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e9b4c92aa7c49da4ec94f1c4278ca6b848421fa4cb5ddbc1a1d35c2c9a32f79d
MD5 37d3d4ba736a4783b01f381018d89664
BLAKE2b-256 f3489b5f4758e5e4779f697498743f113c448b7889c27edd77c855dd201eec9b

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