|
4 | 4 | from ibm_watson import DiscoveryV1 |
5 | 5 |
|
6 | 6 | # If service instance provides API key authentication |
7 | | -# discovery = DiscoveryV1( |
8 | | -# version='2018-08-01', |
9 | | -# ## url is optional, and defaults to the URL below. Use the correct URL for your region. |
10 | | -# url='https://gateway.watsonplatform.net/discovery/api', |
11 | | -# iam_apikey='iam_apikey') |
12 | | - |
13 | 7 | discovery = DiscoveryV1( |
14 | 8 | version='2018-08-01', |
15 | 9 | ## url is optional, and defaults to the URL below. Use the correct URL for your region. |
16 | | - # url='https://gateway.watsonplatform.net/discovery/api', |
17 | | - username='YOUR SERVICE USERNAME', |
18 | | - password='YOUR SERVICE PASSWORD') |
| 10 | + url='https://gateway.watsonplatform.net/discovery/api', |
| 11 | + iam_apikey='YOUR APIKEY') |
| 12 | + |
| 13 | +# discovery = DiscoveryV1( |
| 14 | +# version='2018-08-01', |
| 15 | +# ## url is optional, and defaults to the URL below. Use the correct URL for your region. |
| 16 | +# # url='https://gateway.watsonplatform.net/discovery/api', |
| 17 | +# username='YOUR SERVICE USERNAME', |
| 18 | +# password='YOUR SERVICE PASSWORD') |
19 | 19 |
|
20 | 20 | environments = discovery.list_environments().get_result() |
21 | 21 | print(json.dumps(environments, indent=2)) |
|
60 | 60 | # collections = discovery.list_collections(environment_id=writable_environment_id).get_result() |
61 | 61 | # print(collections) |
62 | 62 |
|
63 | | -# # with open(os.path.join(os.getcwd(),'..', 'resources','simple.html')) as fileinfo: |
64 | | -# # print(discovery.test_document(environment_id=writable_environment_id, fileinfo=fileinfo).get_result()) |
65 | | - |
66 | 63 | # with open(os.path.join(os.getcwd(), '..','resources', 'simple.html')) as fileinfo: |
67 | 64 | # res = discovery.add_document(environment_id=writable_environment_id, |
68 | 65 | # collection_id=collections['collections'][0]['collection_id'], |
|
0 commit comments