autumn-py


Nameautumn-py JSON
Version 1.3.4 PyPI version JSON
download
home_pageNone
SummaryA Python SDK for Autumn's REST API
upload_time2025-07-15 23:31:17
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords autumn payments stripe
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # autumn-py

The Python SDK for [Autumn](https://github.com/useautumn/autumn)'s REST API.

[![PyPI - Version](https://img.shields.io/pypi/v/autumn-py.svg)](https://pypi.org/project/autumn-py)
[![pypi](https://img.shields.io/pypi/pyversions/autumn-py.svg)](https://pypi.org/pypi/autumn-py)
[![Discord](https://img.shields.io/badge/Join%20Community-5865F2?logo=discord&logoColor=white)](https://discord.gg/53emPtY9tA)

## Documentation

The Python SDK's documentation can be found on [ReadTheDocs](https://autumn-py.readthedocs.io).

## Features

- Easily mount Autumn's routes onto your Python backend.
- Support for synchronous and asynchronous contexts.
- Fully typed.

## Installation

> [!NOTE]
> Python 3.9+ is required.

```bash
pip install autumn-py
```

If you want `async` support, you need to install `aiohttp`.

```bash
pip install aiohttp

# Optionally
pip install aiohttp[speedups]

# You can also install it via the "aio" optional dependency.
pip install autumn-py[aio]
```

## Quickstart

```python
import asyncio
from autumn import Autumn

# First, initialize a client.
autumn = Autumn(token="am_sk_test_XESp2wyPE...")

async def main():
    # Attach a customer to a product
    await autumn.attach(
        customer_id="john_doe",
        product_id="chat_messages",
    )

    # Check if the customer has access to the product
    check = await autumn.check(
        customer_id="john_doe",
        product_id="chat_messages",
    )
    if check.allowed is True:
        print("Sending chat message...")

    # Once the customer uses a chat message:
    await autumn.track(
        customer_id="john_doe",
        feature_id="chat_messages",
        value=1,
    )

    # Let's say the customer has run out of chat messages.
    check = await autumn.check(
        customer_id="john_doe",
        feature_id="chat_messages",
    )
    if check.allowed is False:
        print("Customer has run out of chat messages.")

asyncio.run(main())
```

## Synchronous Usage

```python
import autumn

# First, initialize a client.
client = autumn.Client(token="am_sk_test_XESp2wyPE...")

# Attach a customer to a product
client.attach(
    customer_id="john_doe",
    product_id="chat_messages",
)

# Check if the customer has access to the product
check = client.check(
    customer_id="john_doe",
    product_id="chat_messages",
)
if check.allowed is True:
    print("Sending chat message...")

# Once the customer uses a chat message:
client.track(
    customer_id="john_doe",
    feature_id="chat_messages",
    value=1,
)

# Let's say the customer has run out of chat messages.
check = client.check(
    customer_id="john_doe",
    feature_id="chat_messages",
)
if check.allowed is False:
    print("Customer has run out of chat messages.")
```

## License

`autumn-py` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.

## Authors

Originally written by [@justanotherbyte](https://github.com/justanotherbyte).

Maintained by [@johnyeocx](https://github.com/johnyeocx) and [@justanotherbyte](https://github.com/justanotherbyte).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "autumn-py",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "autumn, payments, stripe",
    "author": null,
    "author_email": "John Yeo <johnyeocx@gmail.com>, Viswa Marepalli <reachvishm@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/fa/b3/7be5357ebff244a4c89980199e0215698e5feeaf42e756f3f4acbd5df97e/autumn_py-1.3.4.tar.gz",
    "platform": null,
    "description": "# autumn-py\n\nThe Python SDK for [Autumn](https://github.com/useautumn/autumn)'s REST API.\n\n[![PyPI - Version](https://img.shields.io/pypi/v/autumn-py.svg)](https://pypi.org/project/autumn-py)\n[![pypi](https://img.shields.io/pypi/pyversions/autumn-py.svg)](https://pypi.org/pypi/autumn-py)\n[![Discord](https://img.shields.io/badge/Join%20Community-5865F2?logo=discord&logoColor=white)](https://discord.gg/53emPtY9tA)\n\n## Documentation\n\nThe Python SDK's documentation can be found on [ReadTheDocs](https://autumn-py.readthedocs.io).\n\n## Features\n\n- Easily mount Autumn's routes onto your Python backend.\n- Support for synchronous and asynchronous contexts.\n- Fully typed.\n\n## Installation\n\n> [!NOTE]\n> Python 3.9+ is required.\n\n```bash\npip install autumn-py\n```\n\nIf you want `async` support, you need to install `aiohttp`.\n\n```bash\npip install aiohttp\n\n# Optionally\npip install aiohttp[speedups]\n\n# You can also install it via the \"aio\" optional dependency.\npip install autumn-py[aio]\n```\n\n## Quickstart\n\n```python\nimport asyncio\nfrom autumn import Autumn\n\n# First, initialize a client.\nautumn = Autumn(token=\"am_sk_test_XESp2wyPE...\")\n\nasync def main():\n    # Attach a customer to a product\n    await autumn.attach(\n        customer_id=\"john_doe\",\n        product_id=\"chat_messages\",\n    )\n\n    # Check if the customer has access to the product\n    check = await autumn.check(\n        customer_id=\"john_doe\",\n        product_id=\"chat_messages\",\n    )\n    if check.allowed is True:\n        print(\"Sending chat message...\")\n\n    # Once the customer uses a chat message:\n    await autumn.track(\n        customer_id=\"john_doe\",\n        feature_id=\"chat_messages\",\n        value=1,\n    )\n\n    # Let's say the customer has run out of chat messages.\n    check = await autumn.check(\n        customer_id=\"john_doe\",\n        feature_id=\"chat_messages\",\n    )\n    if check.allowed is False:\n        print(\"Customer has run out of chat messages.\")\n\nasyncio.run(main())\n```\n\n## Synchronous Usage\n\n```python\nimport autumn\n\n# First, initialize a client.\nclient = autumn.Client(token=\"am_sk_test_XESp2wyPE...\")\n\n# Attach a customer to a product\nclient.attach(\n    customer_id=\"john_doe\",\n    product_id=\"chat_messages\",\n)\n\n# Check if the customer has access to the product\ncheck = client.check(\n    customer_id=\"john_doe\",\n    product_id=\"chat_messages\",\n)\nif check.allowed is True:\n    print(\"Sending chat message...\")\n\n# Once the customer uses a chat message:\nclient.track(\n    customer_id=\"john_doe\",\n    feature_id=\"chat_messages\",\n    value=1,\n)\n\n# Let's say the customer has run out of chat messages.\ncheck = client.check(\n    customer_id=\"john_doe\",\n    feature_id=\"chat_messages\",\n)\nif check.allowed is False:\n    print(\"Customer has run out of chat messages.\")\n```\n\n## License\n\n`autumn-py` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.\n\n## Authors\n\nOriginally written by [@justanotherbyte](https://github.com/justanotherbyte).\n\nMaintained by [@johnyeocx](https://github.com/johnyeocx) and [@justanotherbyte](https://github.com/justanotherbyte).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python SDK for Autumn's REST API",
    "version": "1.3.4",
    "project_urls": {
        "Documentation": "https://autumn-py.readthedocs.io",
        "Source": "https://github.com/justanotherbyte/autumn"
    },
    "split_keywords": [
        "autumn",
        " payments",
        " stripe"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7a78e79bbc7f3425149097d1265b1124a679bed1f62c832d7150382204d524fd",
                "md5": "0bbeefa6eb4d1f5015ee9a20bbc449c5",
                "sha256": "df6a642be67439b8d35df35ba7daf4f452c4ead4b7149b4f4b77196c45f8617f"
            },
            "downloads": -1,
            "filename": "autumn_py-1.3.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0bbeefa6eb4d1f5015ee9a20bbc449c5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 22346,
            "upload_time": "2025-07-15T23:31:16",
            "upload_time_iso_8601": "2025-07-15T23:31:16.310030Z",
            "url": "https://files.pythonhosted.org/packages/7a/78/e79bbc7f3425149097d1265b1124a679bed1f62c832d7150382204d524fd/autumn_py-1.3.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "fab37be5357ebff244a4c89980199e0215698e5feeaf42e756f3f4acbd5df97e",
                "md5": "2c2383a3eabbe184c9718e0049af7a61",
                "sha256": "ff3275c148952ab2796ca134082922b789e031e6dae5ccbca9d98aca35aee3dc"
            },
            "downloads": -1,
            "filename": "autumn_py-1.3.4.tar.gz",
            "has_sig": false,
            "md5_digest": "2c2383a3eabbe184c9718e0049af7a61",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 19986,
            "upload_time": "2025-07-15T23:31:17",
            "upload_time_iso_8601": "2025-07-15T23:31:17.187703Z",
            "url": "https://files.pythonhosted.org/packages/fa/b3/7be5357ebff244a4c89980199e0215698e5feeaf42e756f3f4acbd5df97e/autumn_py-1.3.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-15 23:31:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "justanotherbyte",
    "github_project": "autumn",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "autumn-py"
}
        
Elapsed time: 1.61789s