Skip to content

Commit d5d1418

Browse files
authored
Merge pull request #104016 from aahill/bing-search-python
[CogSvcs] constructor updates
2 parents 3063dec + 977a4ee commit d5d1418

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

articles/cognitive-services/Bing-Custom-Search/sdk-python-quickstart.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ manager: nitinme
88
ms.service: cognitive-services
99
ms.subservice: bing-custom-search
1010
ms.topic: quickstart
11-
ms.date: 12/09/2019
11+
ms.date: 02/12/2020
1212
ms.author: aahi
1313
---
1414

@@ -42,17 +42,17 @@ from msrest.authentication import CognitiveServicesCredentials
4242

4343
## Create a search client and send a request
4444

45-
1. Create a variable for your subscription key.
45+
1. Create a variable for your subscription key and endpoint.
4646

4747
```python
4848
subscription_key = 'your-subscription-key'
49-
endpoint = 'your-custom-endpoint'
49+
endpoint = 'your-endpoint'
5050
```
5151

5252
2. Create an instance of `CustomSearchClient`, using a `CognitiveServicesCredentials` object with the subscription key.
5353

5454
```python
55-
client = CustomSearchClient(endpoint, CognitiveServicesCredentials(subscription_key))
55+
client = CustomSearchClient(endpoint=endpoint, credentials=CognitiveServicesCredentials(subscription_key))
5656
```
5757

5858
3. Send a search request with `client.custom_instance.search()`. Append your search term to the `query` parameter, and set `custom_config` to your Custom Configuration ID to use your search instance. You can get your ID from the [Bing Custom Search portal](https://www.customsearch.ai/), by clicking the **Production** tab.

articles/cognitive-services/Bing-Entities-Search/quickstarts/entity-sdk-python-quickstart.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ manager: nitinme
99
ms.service: cognitive-services
1010
ms.subservice: bing-entity-search
1111
ms.topic: quickstart
12-
ms.date: 12/11/2019
12+
ms.date: 02/11/2020
1313
ms.author: aahi
1414
---
1515
# Quickstart: Bing Entity Search SDK with Python
@@ -42,16 +42,17 @@ python -m pip install azure-cognitiveservices-search-entitysearch
4242
1. Create a new Python file in your favorite IDE or editor, and add the following import statements.
4343

4444
```python
45-
from azure.cognitiveservices.search.entitysearch import EntitySearchAPI
45+
from azure.cognitiveservices.search.entitysearch import EntitySearchClient
4646
from azure.cognitiveservices.search.entitysearch.models import Place, ErrorResponseException
4747
from msrest.authentication import CognitiveServicesCredentials
4848
```
4949

50-
2. Create a variable for your subscription key, and instantiate the client by creating a new `CognitiveServicesCredentials` object with it.
50+
2. Create a variable for your subscription key and endpoint. Instantiate the client by creating a new `CognitiveServicesCredentials` object with your key.
5151

5252
```python
5353
subscription_key = "YOUR-SUBSCRIPTION-KEY"
54-
client = EntitySearchAPI(CognitiveServicesCredentials(subscription_key))
54+
endpoint = "YOUR-ENDPOINT"
55+
client = EntitySearchclient(endpoint=endpoint, credentials=CognitiveServicesCredentials(subscription_key))
5556
```
5657

5758
## Send a search request and receive a response

articles/cognitive-services/Bing-Video-Search/quickstarts/sdk-python-quickstart.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ manager: nitinme
99
ms.service: cognitive-services
1010
ms.subservice: bing-video-search
1111
ms.topic: quickstart
12-
ms.date: 12/09/2019
12+
ms.date: 02/11/2020
1313
ms.author: aahi
1414
---
1515

@@ -42,7 +42,7 @@ python -m pip install azure-cognitiveservices-search-videosearch
4242
1. Create a new Python file in your favorite IDE or editor, and add the following import statements.
4343

4444
```python
45-
from azure.cognitiveservices.search.videosearch import VideoSearchAPI
45+
from azure.cognitiveservices.search.videosearch import VideoSearchClient
4646
from azure.cognitiveservices.search.videosearch.models import VideoPricing, VideoLength, VideoResolution, VideoInsightModule
4747
from msrest.authentication import CognitiveServicesCredentials
4848
```
@@ -51,14 +51,15 @@ python -m pip install azure-cognitiveservices-search-videosearch
5151

5252
```python
5353
subscription_key = "YOUR-SUBSCRIPTION-KEY"
54+
endpoint = "YOUR-ENDPOINT"
5455
```
5556

5657
## Create the search client
5758

5859
Create an instance of the `CognitiveServicesCredentials`, and instantiate the client:
5960

6061
```python
61-
client = VideoSearchAPI(CognitiveServicesCredentials(subscription_key))
62+
client = VideoSearchAPI(endpoint, CognitiveServicesCredentials(subscription_key))
6263
```
6364

6465
## Send a search request and get a response

articles/cognitive-services/Bing-Web-Search/web-sdk-python-quickstart.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ manager: nitinme
88
ms.service: cognitive-services
99
ms.subservice: bing-web-search
1010
ms.topic: quickstart
11-
ms.date: 12/09/2019
11+
ms.date: 02/11/2019
1212
ms.author: aahi
1313
---
1414

@@ -85,15 +85,15 @@ If the response contains web pages, images, news, or videos, the first result fo
8585

8686
```python
8787
# Import required modules.
88-
from azure.cognitiveservices.search.websearch import WebSearchAPI
88+
from azure.cognitiveservices.search.websearch import WebSearchClient
8989
from azure.cognitiveservices.search.websearch.models import SafeSearch
9090
from msrest.authentication import CognitiveServicesCredentials
9191

9292
# Replace with your subscription key.
9393
subscription_key = "YOUR_SUBSCRIPTION_KEY"
9494

9595
# Instantiate the client and replace with your endpoint.
96-
client = WebSearchAPI(CognitiveServicesCredentials(subscription_key), base_url = "YOUR_ENDPOINT")
96+
client = WebSearchClient(endpoint="YOUR_ENDPOINT", CognitiveServicesCredentials(subscription_key))
9797

9898
# Make a request. Replace Yosemite if you'd like.
9999
web_data = client.web.search(query="Yosemite")

0 commit comments

Comments
 (0)