diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/__init__.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/__init__.py index fd6c0d40bb86..5e34711b52be 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/__init__.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/__init__.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .custom_search_api import CustomSearchAPI +from .custom_search_client import CustomSearchClient from .version import VERSION -__all__ = ['CustomSearchAPI'] +__all__ = ['CustomSearchClient'] __version__ = VERSION diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/custom_search_api.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/custom_search_client.py similarity index 84% rename from azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/custom_search_api.py rename to azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/custom_search_client.py index 84180bb113ab..ce11760e895c 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/custom_search_api.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/custom_search_client.py @@ -16,8 +16,8 @@ from . import models -class CustomSearchAPIConfiguration(Configuration): - """Configuration for CustomSearchAPI +class CustomSearchClientConfiguration(Configuration): + """Configuration for CustomSearchClient Note that all parameters used to create this instance are saved as instance attributes. @@ -35,18 +35,18 @@ def __init__( if not base_url: base_url = 'https://api.cognitive.microsoft.com/bingcustomsearch/v7.0' - super(CustomSearchAPIConfiguration, self).__init__(base_url) + super(CustomSearchClientConfiguration, self).__init__(base_url) self.add_user_agent('azure-cognitiveservices-search-customsearch/{}'.format(VERSION)) self.credentials = credentials -class CustomSearchAPI(SDKClient): +class CustomSearchClient(SDKClient): """The Bing Custom Search API lets you send a search query to Bing and get back search results customized to meet your custom search definition. :ivar config: Configuration for client. - :vartype config: CustomSearchAPIConfiguration + :vartype config: CustomSearchClientConfiguration :ivar custom_instance: CustomInstance operations :vartype custom_instance: azure.cognitiveservices.search.customsearch.operations.CustomInstanceOperations @@ -60,8 +60,8 @@ class CustomSearchAPI(SDKClient): def __init__( self, credentials, base_url=None): - self.config = CustomSearchAPIConfiguration(credentials, base_url) - super(CustomSearchAPI, self).__init__(self.config.credentials, self.config) + self.config = CustomSearchClientConfiguration(credentials, base_url) + super(CustomSearchClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self.api_version = '1.0' diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/__init__.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/__init__.py index 89301a0c7a0d..291919880acb 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/__init__.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/__init__.py @@ -41,7 +41,7 @@ from .thing import Thing from .creative_work import CreativeWork from .response_base import ResponseBase -from .custom_search_api_enums import ( +from .custom_search_client_enums import ( ErrorCode, ErrorSubCode, SafeSearch, diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/custom_search_api_enums.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/custom_search_client_enums.py similarity index 100% rename from azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/custom_search_api_enums.py rename to azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/custom_search_client_enums.py diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/operations/custom_instance_operations.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/operations/custom_instance_operations.py index 62a2605540bb..a90c6bfb63b3 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/operations/custom_instance_operations.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/operations/custom_instance_operations.py @@ -42,7 +42,7 @@ def search( :param custom_config: The identifier for the custom search configuration - :type custom_config: long + :type custom_config: str :param query: The user's search query term. The term may not be empty. The term may contain Bing Advanced Operators. For example, to limit results to a specific domain, use the site: operator. @@ -262,7 +262,7 @@ def search( # Construct parameters query_parameters = {} - query_parameters['customConfig'] = self._serialize.query("custom_config", custom_config, 'long', minimum=0) + query_parameters['customConfig'] = self._serialize.query("custom_config", custom_config, 'str') if country_code is not None: query_parameters['cc'] = self._serialize.query("country_code", country_code, 'str') if count is not None: @@ -283,7 +283,7 @@ def search( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) header_parameters['X-BingApis-SDK'] = self._serialize.header("self.x_bing_apis_sdk", self.x_bing_apis_sdk, 'str') @@ -299,8 +299,8 @@ def search( header_parameters['X-Search-Location'] = self._serialize.header("location", location, 'str') # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response)