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
Project details
Release history Release notifications | RSS feed
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.2.5.tar.gz
(3.9 kB
view hashes)
Built Distribution
Close
Hashes for decisionrulespy-1.2.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f5730c2b49a60e3c590ffc99f26978f8ee69834d5afa8e3ecfd7cc31051a964 |
|
MD5 | e5c7166fb5a02853936b7d8d9b2f815c |
|
BLAKE2b-256 | e84225ed8e70f4c2a658cda31fd404ded17bd8feb1e3ab672a7576331c2ea89d |