webhook2lambda2sqs.utils module¶
-
webhook2lambda2sqs.utils.
pretty_json
(obj)[source]¶ Given an object, return a pretty-printed JSON representation of it.
Parameters: obj (object) – input object Returns: pretty-printed JSON representation Return type: str
-
webhook2lambda2sqs.utils.
read_json_file
(fpath)[source]¶ Read a JSON file from
fpath
; raise an exception if it doesn’t exist.Parameters: fpath (str) – path to file to read Returns: deserialized JSON Return type: dict
-
webhook2lambda2sqs.utils.
run_cmd
(args, stream=False, shell=True)[source]¶ Execute a command via
subprocess.Popen
; return its output (string, combined STDOUT and STDERR) and exit code (int). If stream is True, also stream the output to STDOUT in realtime.Parameters: Returns: 2-tuple of (combined output (str), return code (int))
Return type: