Successfully built RMASS message push module, sender id resolver from DM room and included processing for 204 HTTP response with no content when handling incoming JSON
This commit is contained in:
+20
-18
@@ -1,30 +1,32 @@
|
||||
import json
|
||||
|
||||
def buildOutput(response, action, outputs):
|
||||
#if select_data != "not applied":
|
||||
#response_data = select_data
|
||||
#else:
|
||||
#response_data = response.json()
|
||||
if hasattr(action, "outputs"):
|
||||
try:
|
||||
response_data = response.json()
|
||||
except AttributeError:
|
||||
response_data = json.loads(response)
|
||||
response_objects = [response_data]
|
||||
if response != None:
|
||||
try:
|
||||
response_data = response.json()
|
||||
except AttributeError:
|
||||
response_data = json.loads(response)
|
||||
response_objects = [response_data]
|
||||
|
||||
while response_objects:
|
||||
response_object = response_objects.pop()
|
||||
while response_objects:
|
||||
response_object = response_objects.pop()
|
||||
|
||||
for key, value, in response_object.items():
|
||||
for key, value, in response_object.items():
|
||||
|
||||
if isinstance(value, dict):
|
||||
response_objects.append(value)
|
||||
if isinstance(value, dict):
|
||||
response_objects.append(value)
|
||||
|
||||
for output_name, response_key in action.outputs.items():
|
||||
if key == response_key:
|
||||
outputs[output_name] = value
|
||||
for output_name, response_key in action.outputs.items():
|
||||
if key == response_key:
|
||||
outputs[output_name] = value
|
||||
return outputs
|
||||
|
||||
else:
|
||||
return outputs
|
||||
|
||||
|
||||
|
||||
return outputs
|
||||
#return outputs
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user