-
Notifications
You must be signed in to change notification settings - Fork 822
Expand file tree
/
Copy pathimport os.py
More file actions
30 lines (25 loc) · 898 Bytes
/
import os.py
File metadata and controls
30 lines (25 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)}")