spaps


Namespaps JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummarySweet Potato Authentication & Payment Service Python client
upload_time2025-10-10 02:26:42
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT License Copyright (c) 2025 Sweet Potato Team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords authentication payments spaps sweet-potato
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ---
id: spaps-python-sdk
title: Sweet Potato Python Client
category: sdk
tags:
  - sdk
  - python
  - client
ai_summary: |
  Explains installation, configuration, and usage patterns for the spaps Python
  SDK, including environment setup, async support, and integration guidance for
  backend services.
last_updated: 2025-02-14
---

# Sweet Potato Python Client

> Python SDK for the Sweet Potato Authentication & Payment Service (SPAPS).

This package is under active development. Follow the TDD plan in `TDD_PLAN.md`
to track progress and upcoming milestones.

## Installation

Install from PyPI:

```bash
pip install spaps
```

For local development inside this repository:

```bash
pip install -e .[dev]
```

## Development

```bash
pytest
```

### Available clients

- `AuthClient` – wallet, email/password, and magic link flows
- `SessionsClient` – current session, validation, listing, revocation
- `PaymentsClient` – checkout sessions, wallet deposits, crypto invoices
- `UsageClient` – feature usage snapshots, recording, aggregated history
- `SecureMessagesClient` – encrypted message creation and retrieval
- `MetricsClient` – health and metrics convenience helpers

### Quickstart

```python
from spaps_client import SpapsClient

spaps = SpapsClient(base_url="http://localhost:3300", api_key="test_key_local_dev_only")

# Authenticate (tokens are persisted automatically)
spaps.auth.sign_in_with_password(email="user@example.com", password="Secret123!")

# Call downstream services using the stored access token
current = spaps.sessions.get_current_session()
print(current.session_id)

checkout = spaps.payments.create_checkout_session(
    price_id="price_123",
    mode="subscription",
    success_url="https://example.com/success",
    cancel_url="https://example.com/cancel",
)
print(checkout.checkout_url)

spaps.close()
```

Configure retry/backoff and structured logging when constructing the client:

```python
from spaps_client import SpapsClient, RetryConfig, default_logging_hooks

spaps = SpapsClient(
    base_url="http://localhost:3300",
    api_key="test_key_local_dev_only",
    retry_config=RetryConfig(max_attempts=4, backoff_factor=0.2),
    logging_hooks=default_logging_hooks(),
)
```

### Async Quickstart

```python
import asyncio
from spaps_client import AsyncSpapsClient

async def main():
    client = AsyncSpapsClient(base_url="http://localhost:3300", api_key="test_key_local_dev_only")
    try:
        await client.auth.sign_in_with_password(email="user@example.com", password="Secret123!")
        current = await client.sessions.list_sessions()
        print(len(current.sessions))
    finally:
        await client.aclose()

asyncio.run(main())
```

### Useful Scripts

```bash
npm run test:python-client   # run pytest from repo root
npm run lint:python-client   # ruff linting
npm run typecheck:python-client # mypy type checking
npm run build:python-client  # build wheel/sdist and run twine check
npm run publish:python-client # build and upload via twine (requires PYPI_TOKEN)
```

Refer to `docs/RELEASE_CHECKLIST.md` for the full release process.

Refer to the repository root documentation for integration details.

## Documentation

- [Quickstart (Python section)](../../docs/getting-started/quickstart.md#python-example---using-spaps)
- [Python Backend Integration Guide](../../docs/guides/python-backend.md)
- API references under `docs/api/` include Python usage snippets for sessions, payments, usage, whitelist, and secure messages.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "spaps",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "authentication, payments, spaps, sweet-potato",
    "author": null,
    "author_email": "Sweet Potato Team <support@sweetpotato.dev>",
    "download_url": "https://files.pythonhosted.org/packages/c2/8b/ae6150b1ef8b66346e4b0a83ce3a24db646804665f1a548246577968d674/spaps-0.1.1.tar.gz",
    "platform": null,
    "description": "---\nid: spaps-python-sdk\ntitle: Sweet Potato Python Client\ncategory: sdk\ntags:\n  - sdk\n  - python\n  - client\nai_summary: |\n  Explains installation, configuration, and usage patterns for the spaps Python\n  SDK, including environment setup, async support, and integration guidance for\n  backend services.\nlast_updated: 2025-02-14\n---\n\n# Sweet Potato Python Client\n\n> Python SDK for the Sweet Potato Authentication & Payment Service (SPAPS).\n\nThis package is under active development. Follow the TDD plan in `TDD_PLAN.md`\nto track progress and upcoming milestones.\n\n## Installation\n\nInstall from PyPI:\n\n```bash\npip install spaps\n```\n\nFor local development inside this repository:\n\n```bash\npip install -e .[dev]\n```\n\n## Development\n\n```bash\npytest\n```\n\n### Available clients\n\n- `AuthClient` \u2013 wallet, email/password, and magic link flows\n- `SessionsClient` \u2013 current session, validation, listing, revocation\n- `PaymentsClient` \u2013 checkout sessions, wallet deposits, crypto invoices\n- `UsageClient` \u2013 feature usage snapshots, recording, aggregated history\n- `SecureMessagesClient` \u2013 encrypted message creation and retrieval\n- `MetricsClient` \u2013 health and metrics convenience helpers\n\n### Quickstart\n\n```python\nfrom spaps_client import SpapsClient\n\nspaps = SpapsClient(base_url=\"http://localhost:3300\", api_key=\"test_key_local_dev_only\")\n\n# Authenticate (tokens are persisted automatically)\nspaps.auth.sign_in_with_password(email=\"user@example.com\", password=\"Secret123!\")\n\n# Call downstream services using the stored access token\ncurrent = spaps.sessions.get_current_session()\nprint(current.session_id)\n\ncheckout = spaps.payments.create_checkout_session(\n    price_id=\"price_123\",\n    mode=\"subscription\",\n    success_url=\"https://example.com/success\",\n    cancel_url=\"https://example.com/cancel\",\n)\nprint(checkout.checkout_url)\n\nspaps.close()\n```\n\nConfigure retry/backoff and structured logging when constructing the client:\n\n```python\nfrom spaps_client import SpapsClient, RetryConfig, default_logging_hooks\n\nspaps = SpapsClient(\n    base_url=\"http://localhost:3300\",\n    api_key=\"test_key_local_dev_only\",\n    retry_config=RetryConfig(max_attempts=4, backoff_factor=0.2),\n    logging_hooks=default_logging_hooks(),\n)\n```\n\n### Async Quickstart\n\n```python\nimport asyncio\nfrom spaps_client import AsyncSpapsClient\n\nasync def main():\n    client = AsyncSpapsClient(base_url=\"http://localhost:3300\", api_key=\"test_key_local_dev_only\")\n    try:\n        await client.auth.sign_in_with_password(email=\"user@example.com\", password=\"Secret123!\")\n        current = await client.sessions.list_sessions()\n        print(len(current.sessions))\n    finally:\n        await client.aclose()\n\nasyncio.run(main())\n```\n\n### Useful Scripts\n\n```bash\nnpm run test:python-client   # run pytest from repo root\nnpm run lint:python-client   # ruff linting\nnpm run typecheck:python-client # mypy type checking\nnpm run build:python-client  # build wheel/sdist and run twine check\nnpm run publish:python-client # build and upload via twine (requires PYPI_TOKEN)\n```\n\nRefer to `docs/RELEASE_CHECKLIST.md` for the full release process.\n\nRefer to the repository root documentation for integration details.\n\n## Documentation\n\n- [Quickstart (Python section)](../../docs/getting-started/quickstart.md#python-example---using-spaps)\n- [Python Backend Integration Guide](../../docs/guides/python-backend.md)\n- API references under `docs/api/` include Python usage snippets for sessions, payments, usage, whitelist, and secure messages.\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2025 Sweet Potato Team\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.\n        ",
    "summary": "Sweet Potato Authentication & Payment Service Python client",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://api.sweetpotato.dev",
        "Repository": "https://github.com/sweet-potato/spaps"
    },
    "split_keywords": [
        "authentication",
        " payments",
        " spaps",
        " sweet-potato"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c958f12c6bb81d069d7a43303b6e377aecb51d0ca24745c9f09161fb9c994117",
                "md5": "9b20a850369606e7930510cdd1186588",
                "sha256": "de7addbd079efb2bd77b999053eee85d09d518a70aebb8af6d1ba14eeeb3ea2c"
            },
            "downloads": -1,
            "filename": "spaps-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9b20a850369606e7930510cdd1186588",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 43142,
            "upload_time": "2025-10-10T02:26:41",
            "upload_time_iso_8601": "2025-10-10T02:26:41.431833Z",
            "url": "https://files.pythonhosted.org/packages/c9/58/f12c6bb81d069d7a43303b6e377aecb51d0ca24745c9f09161fb9c994117/spaps-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c28bae6150b1ef8b66346e4b0a83ce3a24db646804665f1a548246577968d674",
                "md5": "e91684a9f9621465bf5e236fbec63eee",
                "sha256": "3c491fe764b151c081d654d647856f6236262e0c665b97b31ff31ee9f910f67d"
            },
            "downloads": -1,
            "filename": "spaps-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e91684a9f9621465bf5e236fbec63eee",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 76517,
            "upload_time": "2025-10-10T02:26:42",
            "upload_time_iso_8601": "2025-10-10T02:26:42.613437Z",
            "url": "https://files.pythonhosted.org/packages/c2/8b/ae6150b1ef8b66346e4b0a83ce3a24db646804665f1a548246577968d674/spaps-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-10 02:26:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sweet-potato",
    "github_project": "spaps",
    "github_not_found": true,
    "lcname": "spaps"
}
        
Elapsed time: 0.90860s