watson_developer_cloud.discovery_v1 module

The v1 Discovery Service (http://www.ibm.com/watson/developercloud/doc/discovery/)

class DiscoveryV1(version, url='https://gateway.watsonplatform.net/discovery/api', username=None, password=None, use_vcap_services=True)[source]

Bases: watson_developer_cloud.watson_developer_cloud_service.WatsonDeveloperCloudService

Client for Discovery service

get_environments()[source]

Retrieves information about the environments associated with the user

get_environment(environment_id)[source]

Retrieves information about the specific :param environment_id: :return:

create_environment(name='', description='', size=1)[source]
Parameters:
  • name – name of the environment (max 255 chars) can be empty
  • description – description of the environment (max 255 chars)

can be empty :param size: size of the environment (1,2, or 3) :return:

update_environment(environment_id, name='', description='')[source]
Parameters:
  • environment_id – guid of the environment to modify
  • name – update the name of the environment
  • description – update the description of the environment
Returns:

delete_environment(environment_id)[source]

Deletes the specified environment. :param environment_id: guid of environment to delete :return:

list_configurations(environment_id)[source]
get_default_configuration_id(environment_id)[source]
get_configuration(environment_id, configuration_id)[source]
create_configuration(environment_id, config_data)[source]
delete_configuration(environment_id, configuration_id)[source]
update_configuration(environment_id, configuration_id, config_data)[source]
list_collections(environment_id)[source]

Retrieves information about the collections within a given environment :param environment_id: this is the guid of a valid environment :return: json results of the collections in an environment

get_collection(environment_id, collection_id)[source]

Retrieves information about a sepcific collection in an environment :param environment_id: the guid of a valid environment :param collection_id: the guid of a valid collection :return: json results of the collection information

create_collection(environment_id, name, description='', configuration_id=None)[source]
list_collection_fields(environment_id, collection_id)[source]
delete_collection(environment_id, collection_id)[source]
add_document(environment_id, collection_id, file_info=None, file_data=None, mime_type=None, metadata=None)[source]
test_document(environment_id, fileinfo, configuration_id=None, metadata=None)[source]
get_document(environment_id, collection_id, document_id)[source]

Get document status :param environment_id the guid of the environment :param collection_id collection guid :param document_id the id of the document :return dict of document info, not the contents.

delete_document(environment_id, collection_id, document_id)[source]
query(environment_id, collection_id, query_options)[source]
Performs a query and returns the results.
Parameters:
  • environment_id – the guid of a valid environment
  • collection_id – the guid of a valid collection
  • query_options – this is a hash of query params and their values
Returns: