From e012a4aa7577a7250c5e88da3dab5df110bc9877 Mon Sep 17 00:00:00 2001 From: daoleno Date: Fri, 7 Apr 2023 16:22:07 +0800 Subject: [PATCH] add debug info if server encounters an error --- runpod_api_test.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runpod_api_test.py b/runpod_api_test.py index b6b9dc3..31d1794 100644 --- a/runpod_api_test.py +++ b/runpod_api_test.py @@ -18,6 +18,9 @@ def generation(): "input": {"prompt": prompt, "steps": 28, "negative_prompt": negative_prompt, "width": 512, "height": 768, "sampler_index": "DPM++ SDE Karras", "batch_size": 1, "seed": -1}, }) + if res.status_code != 200: + print(f"request failed: url: {res.url}, status code: {res.status_code}, text: {res.text}") + return task_id = res.json()['id'] @@ -26,6 +29,9 @@ def generation(): 'Content-Type': 'application/json', "Authorization": f"Bearer {runpod_key}" }) + if res.status_code != 200: + print(f"request failed: url: {res.url}, status code: {res.status_code}, text: {res.text}") + break status = res.json()['status'] print(status)