Skip to main content

No project description provided

Project description

Spackle Python Library

CI pypi

The Spackle Python library provides optimized access to billing aware flags created on the Spackle platform.

Documentation

See the Python API docs.

Setup

Install the Spackle library

pip install -U spackle-python

Configure your environment

In order to use Spackle, you need to configure your API key on the spackle module. You can find your API key in Spackle app settings page.

import spackle
spackle.api_key = "<api key>"

Bootstrap the client (optional)

The Spackle client requires a single initialization step that includes a network request. To front load this process, you can call the bootstrap method in your codebase.

spackle.bootstrap()

Usage

Fetch a customer

Spackle uses stripe ids as references to customer features.

customer = spackle.Customer.retrieve("cus_00000000")

Verify feature access

customer.enabled("feature_key")

Fetch a feature limit

customer.limit("feature_key")

Logging

The Spackle Python library emits logs as it performs various internal tasks. You can control the verbosity of Spackle's logging a few different ways:

  1. Set the environment variable SPACKLE_LOG to the value debug or info

    $ export SPACKLE_LOG=debug
    
  2. Set spackle.log:

    import spackle
    spackle.log = 'debug'
    
  3. Enable it through Python's logging module:

    import logging
    logging.basicConfig()
    logging.getLogger('spackle').setLevel(logging.DEBUG)
    

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

spackle-python-0.0.28.tar.gz (5.9 kB view hashes)

Uploaded Source

Built Distribution

spackle_python-0.0.28-py3-none-any.whl (7.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