spliit-api-client


Namespliit-api-client JSON
Version 0.1.5 PyPI version JSON
download
home_pageNone
SummaryPython client for the Spliit expense sharing application API. Fork of guysoft/SpliitApi.
upload_time2025-02-11 17:55:05
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords api client expenses sharing spliit
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Spliit API Client

A Python client for interacting with the Spliit expense sharing application API.

This project is a fork of [guysoft/SpliitApi](https://github.com/guysoft/SpliitApi), with additional features and improvements.

## Installation

```bash
pip install spliit-api-client
```

## Usage

```python
from spliit.client import Spliit
from spliit.utils import SplitMode

# Initialize the client with your group ID
client = Spliit(group_id="your_group_id")

# Get group details
group = client.get_group()
print(f"Group: {group['name']}")

# Get participants
participants = client.get_participants()
print("Participants:", participants)

# Add an expense with even split (default)
expense = client.add_expense(
    title="Dinner",
    paid_by="participant_id",  # ID of the person who paid
    paid_for=[
        ("participant1_id", 1),  # Share values are ignored in EVENLY mode
        ("participant2_id", 1),
    ],
    amount=5000,  # $50.00 in cents
    notes="Great dinner!"  # Optional notes
)

# Add an expense with percentage split
expense = client.add_expense(
    title="Groceries",
    paid_by="participant_id",
    paid_for=[
        ("participant1_id", 70),  # 70% of the total
        ("participant2_id", 30),  # 30% of the total
    ],
    amount=3000,  # $30.00 in cents
    split_mode=SplitMode.BY_PERCENTAGE
)

# Add an expense with exact amounts
expense = client.add_expense(
    title="Movie tickets",
    paid_by="participant_id",
    paid_for=[
        ("participant1_id", 1500),  # $15.00 in cents
        ("participant2_id", 1500),  # $15.00 in cents
    ],
    amount=3000,  # $30.00 in cents
    split_mode=SplitMode.BY_AMOUNT
)

# Get all expenses
expenses = client.get_expenses()
for expense in expenses:
    print(f"\n{expense['title']} - {expense['amount']/100:.2f} {group['currency']}")
    print(f"Paid by: {expense['paidBy']['name']}")

# Get specific expense details
expense_details = client.get_expense("expense_id")

# Remove an expense
client.remove_expense("expense_id")
```

## Features

- Get group details and participants
- Add expenses with multiple split modes:
  - Even split
  - Split by percentage
  - Split by exact amounts
  - Split by shares
- Add notes to expenses
- Get expense details
- Remove expenses
- List all expenses in a group

## Development

To set up for development:

```bash
# Clone the repository
git clone https://github.com/makp0/spliit-api-client.git
cd spliit-api-client

# Create a virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest tests/
```

## License

MIT License
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "spliit-api-client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "makp0 <me@polupan.dev>",
    "keywords": "api, client, expenses, sharing, spliit",
    "author": null,
    "author_email": "makp0 <me@polupan.dev>",
    "download_url": "https://files.pythonhosted.org/packages/7d/16/7158e728edaaac2d6daa218796744df386092a5443b77594ec563c46c6bb/spliit_api_client-0.1.5.tar.gz",
    "platform": null,
    "description": "# Spliit API Client\n\nA Python client for interacting with the Spliit expense sharing application API.\n\nThis project is a fork of [guysoft/SpliitApi](https://github.com/guysoft/SpliitApi), with additional features and improvements.\n\n## Installation\n\n```bash\npip install spliit-api-client\n```\n\n## Usage\n\n```python\nfrom spliit.client import Spliit\nfrom spliit.utils import SplitMode\n\n# Initialize the client with your group ID\nclient = Spliit(group_id=\"your_group_id\")\n\n# Get group details\ngroup = client.get_group()\nprint(f\"Group: {group['name']}\")\n\n# Get participants\nparticipants = client.get_participants()\nprint(\"Participants:\", participants)\n\n# Add an expense with even split (default)\nexpense = client.add_expense(\n    title=\"Dinner\",\n    paid_by=\"participant_id\",  # ID of the person who paid\n    paid_for=[\n        (\"participant1_id\", 1),  # Share values are ignored in EVENLY mode\n        (\"participant2_id\", 1),\n    ],\n    amount=5000,  # $50.00 in cents\n    notes=\"Great dinner!\"  # Optional notes\n)\n\n# Add an expense with percentage split\nexpense = client.add_expense(\n    title=\"Groceries\",\n    paid_by=\"participant_id\",\n    paid_for=[\n        (\"participant1_id\", 70),  # 70% of the total\n        (\"participant2_id\", 30),  # 30% of the total\n    ],\n    amount=3000,  # $30.00 in cents\n    split_mode=SplitMode.BY_PERCENTAGE\n)\n\n# Add an expense with exact amounts\nexpense = client.add_expense(\n    title=\"Movie tickets\",\n    paid_by=\"participant_id\",\n    paid_for=[\n        (\"participant1_id\", 1500),  # $15.00 in cents\n        (\"participant2_id\", 1500),  # $15.00 in cents\n    ],\n    amount=3000,  # $30.00 in cents\n    split_mode=SplitMode.BY_AMOUNT\n)\n\n# Get all expenses\nexpenses = client.get_expenses()\nfor expense in expenses:\n    print(f\"\\n{expense['title']} - {expense['amount']/100:.2f} {group['currency']}\")\n    print(f\"Paid by: {expense['paidBy']['name']}\")\n\n# Get specific expense details\nexpense_details = client.get_expense(\"expense_id\")\n\n# Remove an expense\nclient.remove_expense(\"expense_id\")\n```\n\n## Features\n\n- Get group details and participants\n- Add expenses with multiple split modes:\n  - Even split\n  - Split by percentage\n  - Split by exact amounts\n  - Split by shares\n- Add notes to expenses\n- Get expense details\n- Remove expenses\n- List all expenses in a group\n\n## Development\n\nTo set up for development:\n\n```bash\n# Clone the repository\ngit clone https://github.com/makp0/spliit-api-client.git\ncd spliit-api-client\n\n# Create a virtual environment\npython -m venv venv\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\n\n# Install development dependencies\npip install -e \".[dev]\"\n\n# Run tests\npytest tests/\n```\n\n## License\n\nMIT License",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python client for the Spliit expense sharing application API. Fork of guysoft/SpliitApi.",
    "version": "0.1.5",
    "project_urls": {
        "Homepage": "https://github.com/maxpol/spliit-api-client",
        "Issues": "https://github.com/maxpol/spliit-api-client/issues",
        "Original Repository": "https://github.com/guysoft/SpliitApi",
        "Repository": "https://github.com/maxpol/spliit-api-client.git"
    },
    "split_keywords": [
        "api",
        " client",
        " expenses",
        " sharing",
        " spliit"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b00a0c4b2fde020e06c414d32e86ace06d2b515136363a5e7a5deefaf2652535",
                "md5": "c11d4338a451487161477b5a63564289",
                "sha256": "cd28fd409ab545519fca6af323c6cf3320703c0e2f2bdb6e2327aeaffee19ea9"
            },
            "downloads": -1,
            "filename": "spliit_api_client-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c11d4338a451487161477b5a63564289",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 3133,
            "upload_time": "2025-02-11T17:55:03",
            "upload_time_iso_8601": "2025-02-11T17:55:03.934769Z",
            "url": "https://files.pythonhosted.org/packages/b0/0a/0c4b2fde020e06c414d32e86ace06d2b515136363a5e7a5deefaf2652535/spliit_api_client-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7d167158e728edaaac2d6daa218796744df386092a5443b77594ec563c46c6bb",
                "md5": "3b15712a4fdece80a75cf31a093c47fb",
                "sha256": "903ff26c0661490f0766c7c29013b34d184df7281d5002689a0f066df4ba81a9"
            },
            "downloads": -1,
            "filename": "spliit_api_client-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "3b15712a4fdece80a75cf31a093c47fb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 9567,
            "upload_time": "2025-02-11T17:55:05",
            "upload_time_iso_8601": "2025-02-11T17:55:05.001690Z",
            "url": "https://files.pythonhosted.org/packages/7d/16/7158e728edaaac2d6daa218796744df386092a5443b77594ec563c46c6bb/spliit_api_client-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-11 17:55:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "maxpol",
    "github_project": "spliit-api-client",
    "github_not_found": true,
    "lcname": "spliit-api-client"
}
        
Elapsed time: 1.02796s