How to use the azure-cognitiveservices-search-websearch.azure.cognitiveservices.search.websearch.models.ErrorResponseException function in azure-cognitiveservices-search-websearch

To help you get started, we’ve selected a few azure-cognitiveservices-search-websearch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-sdk-for-python / azure-cognitiveservices-search-websearch / azure / cognitiveservices / search / websearch / operations / web_operations.py View on Github external
header_parameters['Pragma'] = self._serialize.header("pragma", pragma, 'str')
        if user_agent is not None:
            header_parameters['User-Agent'] = self._serialize.header("user_agent", user_agent, 'str')
        if client_id is not None:
            header_parameters['X-MSEdge-ClientID'] = self._serialize.header("client_id", client_id, 'str')
        if client_ip is not None:
            header_parameters['X-MSEdge-ClientIP'] = self._serialize.header("client_ip", client_ip, 'str')
        if location is not None:
            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)

        if response.status_code not in [200]:
            raise models.ErrorResponseException(self._deserialize, response)

        deserialized = None

        if response.status_code == 200:
            deserialized = self._deserialize('SearchResponse', response)

        if raw:
            client_raw_response = ClientRawResponse(deserialized, response)
            return client_raw_response

        return deserialized
    search.metadata = {'url': '/search'}

azure-cognitiveservices-search-websearch

Microsoft Azure Cognitive Services Web Search Client Library for Python

MIT
Latest version published 5 months ago

Package Health Score

84 / 100
Full package analysis

Popular azure-cognitiveservices-search-websearch functions