From 704ac488112233e202b08cb3f9bef3448fb9fae2 Mon Sep 17 00:00:00 2001 From: cloudant-sdks-automation <71659186+cloudant-sdks-automation@users.noreply.github.com> Date: Fri, 14 Nov 2025 10:06:13 +0000 Subject: [PATCH] fix(generated): improve _up examples Generated SDK source code using: - Generator version 3.107.1 - Specification version 1.0.0-dev0.1.30 - Automation (cloudant-sdks) version e8e7dee --- examples/README.md | 13 ++++++++++--- .../snippets/getUpInformation/example_request.py | 13 ++++++++++--- .../snippets/headUpInformation/example_request.py | 14 ++++++++++++++ 3 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 examples/snippets/headUpInformation/example_request.py diff --git a/examples/README.md b/examples/README.md index 3331e4b2..6012bf94 100644 --- a/examples/README.md +++ b/examples/README.md @@ -549,12 +549,19 @@ _GET `/_up`_ ```py # section: code from ibmcloudant.cloudant_v1 import CloudantV1 +from ibm_cloud_sdk_core.api_exception import ApiException service = CloudantV1.new_instance() +try: + response = service.get_up_information() -response = service.get_up_information().get_result() - -print(response) + print("Service is up and healthy") + print(response.get_result()) +except ApiException as ae: + if ae.code == 503: + print(f"Service is unavailable, status code: {ae.code}") + else: + print(f"Issue performing health check, status code: {ae.code}, message: {ae.http_response.reason}") ``` ## getUuids diff --git a/examples/snippets/getUpInformation/example_request.py b/examples/snippets/getUpInformation/example_request.py index 4e6be59e..215a2208 100644 --- a/examples/snippets/getUpInformation/example_request.py +++ b/examples/snippets/getUpInformation/example_request.py @@ -1,8 +1,15 @@ # section: code from ibmcloudant.cloudant_v1 import CloudantV1 +from ibm_cloud_sdk_core.api_exception import ApiException service = CloudantV1.new_instance() +try: + response = service.get_up_information() -response = service.get_up_information().get_result() - -print(response) + print("Service is up and healthy") + print(response.get_result()) +except ApiException as ae: + if ae.code == 503: + print(f"Service is unavailable, status code: {ae.code}") + else: + print(f"Issue performing health check, status code: {ae.code}, message: {ae.http_response.reason}") diff --git a/examples/snippets/headUpInformation/example_request.py b/examples/snippets/headUpInformation/example_request.py new file mode 100644 index 00000000..9942e6d6 --- /dev/null +++ b/examples/snippets/headUpInformation/example_request.py @@ -0,0 +1,14 @@ +# section: code +from ibmcloudant.cloudant_v1 import CloudantV1 +from ibm_cloud_sdk_core.api_exception import ApiException + +service = CloudantV1.new_instance() +try: + response = service.head_up_information() + + print("Service is up and healthy") +except ApiException as ae: + if ae.code == 503: + print(f"Service is unavailable, status code: {ae.code}") + else: + print(f"Issue performing health check, status code: {ae.code}, message: {ae.http_response.reason}")