From a3318a130aeb36bd38540a816c36d9279001f586 Mon Sep 17 00:00:00 2001 From: BBMKS <66208164+BBMKS@users.noreply.github.com> Date: Sun, 13 Apr 2025 16:39:28 +0530 Subject: [PATCH] SSL Error Discovery solved SSL Error Discovery solved --- import os.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 import os.py diff --git a/import os.py b/import os.py new file mode 100644 index 00000000..dffa4895 --- /dev/null +++ b/import os.py @@ -0,0 +1,30 @@ +import os +import requests +from watson_developer_cloud import DiscoveryV2 + +# Disable SSL verification globally for requests made by Watson SDK +requests.packages.urllib3.disable_warnings(requests.packages.urllib3.exceptions.InsecureRequestWarning) + +# Set your Watson Discovery credentials +api_key = "YOUR_API_KEY" +service_url = "YOUR_SERVICE_URL" +version = "2021-08-01" # Specify the correct API version + +# Instantiate the Discovery V2 client +discovery = DiscoveryV2( + version=version, + iam_apikey=api_key, + url=service_url, + disable_ssl_verification=True # Disable SSL verification here +) + +# Example: Get the list of collections (as a test endpoint) +try: + response = discovery.list_collections( + environment_id="YOUR_ENVIRONMENT_ID" + ).get_result() + print("Collections retrieved successfully:") + print(response) +except Exception as e: + print(f"Error: {str(e)}") +