[Progress Communities] [Progress OpenEdge ABL] Forum Post: RE: Integration of Python with Corticon Decision Service

  • Thread starter Thread starter gsaintma
  • Start date Start date
Status
Not open for further replies.
G

gsaintma

Guest
The attachment did not get through. Here is the file: # # Copyright 2017 by Progress Software Corporation. All rights reserved. # # Python sample for making a REST execution call to corticon decision service. # For this execution to work you need the ProcessOrder decision service # deployed to your server. import requests import json #Declare connection properties corticonServerProtocol = 'http' corticonServerAddress = 'localhost' corticonServerPort = '8850' corticonServerPath = '/axis/corticon/execute' #File location jsonFilePath = '../../data/OrderProcessingPayload.json' #Read the file with open(jsonFilePath, 'r') as f: jsonfileContents = f.read() #Connect to the server corticonURL = corticonServerProtocol + "://" + corticonServerAddress + ":" + corticonServerPort + corticonServerPath response = requests.post(corticonURL, data=jsonfileContents, headers={'Content-type' : 'application/json'}) #Pretty-print the JSON responseText = response.text responseJSON = json.loads(responseText) print json.dumps(responseJSON, indent=2, sort_keys=True)

Continue reading...
 
Status
Not open for further replies.
Back
Top