Skip to main content

Planship API client

Project description

planship-python

Welcome to the Python client for the Planship API.

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", # Planship product slug
    "https://api.planship.io", # Planship API endpoint URL
    "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
subscription = planship.create_subscription(customer.id, "medium")

# retrieve customer entitlements
entitlements = planship.get_entitlements(customer.id)

# report usage for a customer
planship.report_usage(customer.id, "api-call", 11)

Complete reference

The complete reference for the Planship class can be found here.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

planship-0.1.0.tar.gz (6.2 kB view hashes)

Uploaded Source

Built Distribution

planship-0.1.0-py3-none-any.whl (6.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page