Skip to main content

planship-python

Welcome to the Python client for the Planship API. Planship 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

pip install planship
# or
poetry add planship

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

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.

Links

Release files for planship 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for planship 0.2.1
File Size Uploaded
planship-0.2.1.tar.gz 6.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for planship 0.2.1
File Interpreter ABI Platform
planship-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.6 kB

Release files / planship-0.2.1.tar.gz

Download URL planship-0.2.1.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9980e1db9a0396581d396b98b6a79a6561c1e4ba7ea5673af36f49f604ad6fb9
BLAKE2b-256 checksum
How to use checksums
e15a6135455a9cfe7e656c6988c60449da9c34504525209d8164e49c98b336a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / planship-0.2.1-py3-none-any.whl

Download URL planship-0.2.1-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
770e757962ee6d5f45e3740d4bd43a63f440b5ea4ae56812a8dee276d8c9cf3e
BLAKE2b-256 checksum
How to use checksums
49cf560b1d0518c7dd4486712e8dc6a94389e27fbdf5fda535e7f4053d7990c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page