From fa9b7526f9ca60d1e017ed0fb4b4a965f68cf0ec Mon Sep 17 00:00:00 2001 From: Prince Fefar Date: Wed, 25 Jan 2023 20:55:26 -0800 Subject: [PATCH 1/2] add check ping --- examples/querying.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/querying.py b/examples/querying.py index 1c4e223..458ad83 100644 --- a/examples/querying.py +++ b/examples/querying.py @@ -9,10 +9,10 @@ api_key = "buyer_key" # get this from the fortress web dashboard -ip_addr = "127.0.0.1" +ip_addr = "test-enclave.fortressenclaves-dev.com" # Initialize a buyer instance -buyer = Buyer(api_key, ip_addr) +buyer = Buyer(api_key, ip_addr, use_https=True) # Initiate a query From b2bb04865d908283ede65ffba0b9dc917c1b8bfe Mon Sep 17 00:00:00 2001 From: Prince Fefar Date: Wed, 25 Jan 2023 20:55:53 -0800 Subject: [PATCH 2/2] add check ping --- fortress_sdk/fortress_sdk.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/fortress_sdk/fortress_sdk.py b/fortress_sdk/fortress_sdk.py index b46ddd4..522f16c 100644 --- a/fortress_sdk/fortress_sdk.py +++ b/fortress_sdk/fortress_sdk.py @@ -169,3 +169,20 @@ def print_query_history(self): a=query["accuracy"][44:], ) print(query_string) + + def check_ping(self): + """ + Return ping status for the enclave + + :return: status of the enclave + :rtype: bool + """ + ping_url = f"{self.url}/health" + + r = requests.get(ping_url) + rsp = r.json() + + if rsp["status"] == "ok": + return True + else: + return False