在Azure认知服务上找不到资源

问题描述 投票:1回答:1

我在the tutorial 1之后创建了Azure认知服务资源>

然后我创建了环境并运行以下代码(来自tutorial 2):

# Import required modules.
from azure.cognitiveservices.search.websearch import WebSearchAPI
from azure.cognitiveservices.search.websearch.models import SafeSearch
from msrest.authentication import CognitiveServicesCredentials

# Replace with your subscription key.
subscription_key = "YOUR_SUBSCRIPTION_KEY"

# Instantiate the client and replace with your endpoint.
client = WebSearchAPI(CognitiveServicesCredentials(subscription_key), base_url = "YOUR_ENDPOINT")

# Make a request. Replace Yosemite if you'd like.
web_data = client.web.search(query="Yosemite")
print("\r\nSearched for Query# \" Yosemite \"")

但是,由于出现以下错误,脚本似乎无法正确读取生成的Subscription keyendpoint

文件“ azu_scrapper.py”,第17行,web_data = client.web.search(query =“ Yosemite”)文件“ /home/user/.local/share/virtualenvs/linkedin-CHSAGU1d/lib/python3.7/site-packages/azure/cognitiveservices/search/websearch/操作/web_operations.py”,365行,在搜索中引发models.ErrorResponseException(self._deserialize,response)azure.cognitiveservices.search.websearch.models.error_response_py3.ErrorResponseException:操作返回了无效的状态码“找不到资源”

知道为什么它不起作用?

我在教程1之后创建了Azure Cognitive Services资源。然后,我创建了环境并运行以下代码(来自教程2):#导入所需的模块。来自天蓝色。...

python azure microsoft-cognitive azure-cognitive-search
1个回答
1
投票

base_url值应为:

© www.soinside.com 2019 - 2024. All rights reserved.