semvec/pypi-packages huggingface dataset:
planship 0.2.1
Planship API client
Requires Python: >=3.7
Keywords: Planship

# planship-python

Welcome to the Python client for the [Planship API](https://docs.planship.io/integration). [Planship](https://planship.io) enables developers to build subscription logic for product pricing based on any combination of features, seats, and usage.


## Installation and basic usage

Install `planship` with pip, or another package manager of your choice like Poetry

``` console
pip install planship
# or
poetry add planship
```

Import and instantiate the `Planship` class, and start making calls to the Planship API

```python
from planship import Planship

planship = Planship(
    "clicker-demo",                         # Planship product slug
    "273N1SQ3GQFZ8JSFKIOK",                 # Planship API client ID
    "GDSfzPD2NEM5PEzIl1JoXFRJNZm3uAhX"      # Planship API client secret
)

# List product plans
plans = planship.list_plans()

# Create a customer with a name and email
customer = planship.create_customer({
    "name": "Darth Vader",
    "email:": "vader@empire.gov"
})

# Subscribe the customer to a plan with the slug "medium"
subscription = planship.create_subscription(customer.id, "medium")

# Retrieve entitlements for the customer
entitlements = planship.get_entitlements(customer.id)

# Report 11 units of usage for the "api-call" metering ID for the customer
planship.report_usage(customer.id, "api-call", 11)
```

The complete reference for the `Planship` class can be found [here](https://github.com/planship/planship-python/blob/master/docs/content/planship-class.md).

## Links

- [Planship documentation](https://docs.planship.io)
- [Sign up for Planship](https://app.planship.io/auth/sign-up)
- [Planship Python client class reference](https://github.com/planship/planship-python/blob/master/docs/content/planship-class.md)
- [Planship Python client at PyPI](https://pypi.org/project/planship/)