File tree Expand file tree Collapse file tree 3 files changed +34
-6
lines changed
Expand file tree Collapse file tree 3 files changed +34
-6
lines changed Original file line number Diff line number Diff line change @@ -549,12 +549,19 @@ _GET `/_up`_
549549``` py
550550# section: code
551551from ibmcloudant.cloudant_v1 import CloudantV1
552+ from ibm_cloud_sdk_core.api_exception import ApiException
552553
553554service = CloudantV1.new_instance()
555+ try :
556+ response = service.get_up_information()
554557
555- response = service.get_up_information().get_result()
556-
557- print (response)
558+ print (" Service is up and healthy" )
559+ print (response.get_result())
560+ except ApiException as ae:
561+ if ae.code == 503 :
562+ print (f " Service is unavailable, status code: { ae.code} " )
563+ else :
564+ print (f " Issue performing health check, status code: { ae.code} , message: { ae.http_response.reason} " )
558565```
559566
560567## getUuids
Original file line number Diff line number Diff line change 11# section: code
22from ibmcloudant .cloudant_v1 import CloudantV1
3+ from ibm_cloud_sdk_core .api_exception import ApiException
34
45service = CloudantV1 .new_instance ()
6+ try :
7+ response = service .get_up_information ()
58
6- response = service .get_up_information ().get_result ()
7-
8- print (response )
9+ print ("Service is up and healthy" )
10+ print (response .get_result ())
11+ except ApiException as ae :
12+ if ae .code == 503 :
13+ print (f"Service is unavailable, status code: { ae .code } " )
14+ else :
15+ print (f"Issue performing health check, status code: { ae .code } , message: { ae .http_response .reason } " )
Original file line number Diff line number Diff line change 1+ # section: code
2+ from ibmcloudant .cloudant_v1 import CloudantV1
3+ from ibm_cloud_sdk_core .api_exception import ApiException
4+
5+ service = CloudantV1 .new_instance ()
6+ try :
7+ response = service .head_up_information ()
8+
9+ print ("Service is up and healthy" )
10+ except ApiException as ae :
11+ if ae .code == 503 :
12+ print (f"Service is unavailable, status code: { ae .code } " )
13+ else :
14+ print (f"Issue performing health check, status code: { ae .code } , message: { ae .http_response .reason } " )
You can’t perform that action at this time.
0 commit comments