Skip to main content

A Python package for accessing decision data from JustDecision.com

Project description

decision_lab

pip install decisionlab

Introduction

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()
print(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()
print(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()
print(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 details)

Uploaded Source

Built Distribution

decisionlab-0.1.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file decisionlab-0.1.1.tar.gz.

File metadata

  • Download URL: decisionlab-0.1.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for decisionlab-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e58d4a48dcd0afa6d838c417c60ac9ec922d7f29bd5aa712a54f2b637d7a2174
MD5 80b286373486072d35011f4bdecbb7d2
BLAKE2b-256 2a6b4e694cffa54703bc05b8897f5baa80d6a72051758c944b5977ad0ae5320f

See more details on using hashes here.

File details

Details for the file decisionlab-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: decisionlab-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for decisionlab-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fd216ad20bae5a8dce7e2a8e46848fc479eca08c03fb89ae4d6c554a834162a8
MD5 ad0134cd0875d992610633c3f90cdd70
BLAKE2b-256 422a08c77a7290220ec5617943acf7e65f20e102af474ac68572b1ea894141bb

See more details on using hashes here.

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