GRIDAPPSD / GOSS-GridAPPS-D

14 stars 27 forks source link

Resolves #1766 #1773

Closed poorva1209 closed 2 months ago

poorva1209 commented 3 months ago

To test GLM:

request = {
    "configurationType": "GridLAB-D Base GLM",
    "parameters": {
        "model_id": "_C1C3E687-6FFD-C753-582B-632A27E28507",
    }
}
response = gapps.get_response('goss.gridappsd.process.request.config', request)
json_object = json.loads(response, strict=False)
print(json_object['data'])

To Test DSS:

request = {
    "configurationType": "DSS Base",
    "parameters": {
        "model_id": "_C1C3E687-6FFD-C753-582B-632A27E28507",
    }
}
response = gapps.get_response('goss.gridappsd.process.request.config', request)
json_object = json.loads(response, strict=False)
print(json_object['data'])
afisher1 commented 2 months ago

@poorva1209 I get a TypeError trying to perform json.loads(response).

The response is already a dictionary. What needs to happen is that the contents of response['message'] needs to be json serializable. which it seems to be but on closer look escaped characters like \n and \t need to be \n and \t so when I try to do a json.loads(response['message']) that fails.

poorva1209 commented 2 months ago

@afisher1 Look at the examples in the PR description. it needs to be json_object = json.loads(response, strict=False)