Skip to main content

A Python package for accessing decision data from

Project description


pip install decisionlab


decision_lab is a Python library that provides a simple and intuitive interface for creating and managing "decisions" that can be accessed via APIs. With decision_lab, you can make code behavior changes without changing the code itself, saving time and money on development and maintenance.

Key Features

  • Create and edit decisions through a user-friendly interface.
  • Access decisions via APIs to make code behavior changes without modifying the codebase.
  • Improve user experience and business outcomes with flexible and scalable decision management.

Use Cases

  • Change the welcome message on a website header by editing a decision in the UI, and the change will be reflected on the website.
  • Modify the user list in a backend Python code by calling decision.user_list, without making changes to the codebase.

Getting Started

DecisionLab Class The DecisionLab class is a handy tool designed to interact with the Decision Lab API, allowing users to perform various tasks such as listing decisions, updating decision values, and retrieving specific decision values using provided tokens.

Initialization To get started, you'll need to create an instance of the DecisionLab class in Python:

from decisionlab import DecisionLab
dlab = DecisionLab(token='your_token')

Here, token is a required parameter, and it should be your authentication token for API access. You can use either a read-only or a read-write token, depending on your needs.

Example Usage Let's dive into some practical examples to see how you can use the DecisionLab class.

  1. Listing Decisions with a Read-Only Token If you want to list decisions with a read-only token, you can do so like this:
dlab = DecisionLab(token='your_read_only_token')
decisions = dlab.list_decisions()

Expected Outcome:

This will return a list of decisions, such as ['decision1', 'decision2',]. Please note that this operation can only be performed with a read-only token.

  1. Attempting to Update Decision Value with a Read-Only Token If you attempt to update a decision value with a read-only token, you'll encounter a PermissionError. This is because updating a decision value requires a read-write token.
dlab.update_decision_value('decision_name', new_value)

Expected Outcome:

You'll receive an error message indicating that you do not have the necessary permissions to update the decision value.

  1. Handling Invalid Token In case you provide an invalid token, the DecisionLab class will handle it gracefully:
dlab = DecisionLab(token='invalid_token')
decisions = dlab.list_decisions()

Expected Outcome:

You'll receive an error message, indicating that there are access issues or that the provided token is invalid.

  1. Listing Decisions and Updating Values with a Read-Write Token To both list decisions and update their values, you should use a read-write token and specify it as such when initializing the DecisionLab class:
dlab = DecisionLab(token='your_read_write_token', is_read_write=True)
decisions = dlab.list_decisions()

dlab.update_decision_value('decision_name', new_value)

Expected Outcome:

This will list the decisions available for the given token and successfully update the value of the specified decision. with a json {'success': True} Methods

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

decisionlab-0.1.1.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

decisionlab-0.1.1-py3-none-any.whl (4.6 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