From 41eb081bd7cc8aa1b9ca6c0a7cbf0494f9eb9048 Mon Sep 17 00:00:00 2001 From: strahi-linux Date: Thu, 5 Dec 2024 14:28:50 +0100 Subject: [PATCH] Restored python version --- .github/workflows/demos.yaml | 2 +- scripts/workflows/utils.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/demos.yaml b/.github/workflows/demos.yaml index 093a390..2074115 100644 --- a/.github/workflows/demos.yaml +++ b/.github/workflows/demos.yaml @@ -26,7 +26,7 @@ jobs: - name: Set up python uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.x' - name: Install dependencies run: | diff --git a/scripts/workflows/utils.py b/scripts/workflows/utils.py index e43f7a1..e134d35 100644 --- a/scripts/workflows/utils.py +++ b/scripts/workflows/utils.py @@ -140,15 +140,15 @@ def capture_stdout(func, *args, **kwargs): def fetch_json_from_output(string_in): lines = string_in.split('\n') - print("%sReturn message:\n%s\n\n" % (Colors.UNDERLINE, string_in)) if 'HTTP error' in string_in: for line in lines: if 'Response' in line: + print("%s\nParsed message:\n%s\n" % (Colors.OKCYAN, line)) return json.loads(line.replace('Response: ', '')) else: - print("%sEach line of message:\n" % Colors.UNDERLINE) for line in lines: - print("%s%s" % (Colors.WARNING, line)) + if 'Content-Length: ' in line: + line_cnt = int(line.replace('Content-Length: ', '')) if 'jsonrpc' in line: - print("%s\nParsed message:\n%s\n" % (Colors.OKCYAN, line)) - return json.loads(line) + print("%s\nParsed message:\n%s\n" % (Colors.OKCYAN, line[:line_cnt])) + return json.loads(line[:line_cnt])