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},
)

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.0.tar.gz (4.7 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.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pykitty-0.2.0.tar.gz
  • Upload date:
  • Size: 4.7 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.0.tar.gz
Algorithm Hash digest
SHA256 fa7278ee22504eeff9d5ddfaab55e4e8c46bedb4827be44033587a1a871d0661
MD5 96bb0a477e4bc17505f6028246552e1f
BLAKE2b-256 4400f51b5117138cd4d5f49fec1e2782440990c9f06daf206b7684cc659044be

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pykitty-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be07896aefe1529068f2b34f8ffd7ea9eaa516b7942c7079113516a9006d8a30
MD5 a25619981641ce26fb4a70706aeca804
BLAKE2b-256 f674feabc2673f3fb68a190e3159e2e4461166fd9e9932a81ee84d599369c156

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