Skip to main content

A simple library for simple connecting to DecisionRules API

Project description

DecisionRulespy

Simple async python library that allows you to easily connect to Decisionrules.io from your python application.

Where do i get api key?

You can create your API key here: https://app.decisionrules.io/api-keys

Arguments

  • apiKey - apikey (string)
  • GeoLocation - enum of possible geoLocations (optional argument)
  • ruleId - id of the rule from dashboard (string)
  • data - request object. Omit data object. f.e {data:{myreq: something}} - WRONG, {myreq: something} - GOOD
  • SolverStrategy - enum of possible solver strategies
  • version - version of the rule. optional argument

If you omit version then you will automaticaly get result of your latest version deployed on DecisionRules dashboard.

If you omit geo location your request will be computed on default server in Europe.

We offer these geoLocs:

  • eu1: Ireland
  • eu2: Sweden
  • us1: Virginia
  • us2: North California

Simple usage demo

import decisionrules
import asyncio

apikey = "API_KEY_HERE"
geoLoc = decisionrules.enums.GeoLocations.US2
solver_strategy = decisionrules.SolverStrategies.STANDARD

decisionrules.init(apikey, geoLoc)

data = {"day": "today"}


async def getResult(data):
    result = await decisionrules.solver("RULE_ID_HERE", data, solver_strategy)
    print(result[0]["result"])


loop = asyncio.get_event_loop()

loop.run_until_complete(getResult(data))

Dependencies

Requests

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

decisionrulespy-1.3.1.tar.gz (3.9 kB view hashes)

Uploaded Source

Built Distribution

decisionrulespy-1.3.1-py3-none-any.whl (4.7 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