diff options
author | Serge Simard <serge@agilitae.com> | 2019-10-24 01:42:27 -0400 |
---|---|---|
committer | Serge Simard <serge@agilitae.com> | 2019-10-24 01:45:31 -0400 |
commit | 35ab81bb9ff203e14116de10bc2735ffb2883f67 (patch) | |
tree | 574ff6ea87e099971bc41184cafbc72638b0bf4a /ms/command-executor/src/main/python/cds_utils | |
parent | 4433fa9514ed0a031b797367a0daa9aea611d138 (diff) |
Improve Remote Python Executor error handling and allow for structured response
Issue-ID: CCSDK-1855
Signed-off-by: Serge Simard <serge@agilitae.com>
Change-Id: I924918fb06a5a0f118772dedaa41c536c7eca9e7
Signed-off-by: Serge Simard <serge@agilitae.com>
Diffstat (limited to 'ms/command-executor/src/main/python/cds_utils')
-rw-r--r-- | ms/command-executor/src/main/python/cds_utils/__init__.py | 0 | ||||
-rw-r--r-- | ms/command-executor/src/main/python/cds_utils/payload_coder.py | 13 |
2 files changed, 13 insertions, 0 deletions
diff --git a/ms/command-executor/src/main/python/cds_utils/__init__.py b/ms/command-executor/src/main/python/cds_utils/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/ms/command-executor/src/main/python/cds_utils/__init__.py diff --git a/ms/command-executor/src/main/python/cds_utils/payload_coder.py b/ms/command-executor/src/main/python/cds_utils/payload_coder.py new file mode 100644 index 000000000..951262172 --- /dev/null +++ b/ms/command-executor/src/main/python/cds_utils/payload_coder.py @@ -0,0 +1,13 @@ +import json
+from email.mime import multipart
+from email.mime import text
+import email.parser
+
+def send_response_data_payload(json_payload):
+ m = multipart.MIMEMultipart("form-data")
+ data = text.MIMEText("response_payload", "json", "utf8")
+ data.set_payload(json.JSONEncoder().encode(json_payload))
+ m.attach(data)
+ print("BEGIN_EXTRA_PAYLOAD")
+ print(m.as_string())
+ print("END_EXTRA_PAYLOAD")
\ No newline at end of file |