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
Init arguments
- apiKey - apikey (string)
- GeoLocation - enum of possible geoLocations (optional argument)
- CustomDomain - if you have on-premise solution you can inject your own server domain name and transfer protocol with this class (if normal DR are used you can omit this)
Arguments
- 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.GeoLocations.US2
solver_strategy = decisionrules.SolverStrategies.STANDARD
customDomain = decisionrules.CustomDomain("custom_url", decisionrules.Protocols.HTTPS)
decisionrules.init(apikey, geoLoc, customDomain)
data = {"day": "today"}
async def get_result(request):
result = await decisionrules.solver("RULE_ID_HERE", request, solver_strategy)
print(result[0]["result"])
loop = asyncio.get_event_loop()
loop.run_until_complete(get_result(data))
Dependencies
Project details
None None NoneRelease 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.5.0.tar.gz
(4.2 kB
view hashes)
Built Distribution
Close
Hashes for decisionrulespy-1.5.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cba245357ace609172c4b343949b2f170eb5520bf8d343faa78b3bb09710cb37 |
|
MD5 | e2b3bd4e2a87016723f1fb1e27c55831 |
|
BLAKE2b-256 | c26792762988e6402392019e73f2f8adf026496e7376db645c492c3d20d3d0fe |