[英]Resource not found on Azure Cognitive Services
我按照教程 1創建了一個 Azure 認知服務資源
然后我創建了環境並運行以下代碼(來自教程 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 key
和endpoint
,因為我收到以下錯誤:
文件“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/operations/web_operations.py",第 365 行,在搜索中引發 models.ErrorResponseException(self._deserialize, response) azure.cognitiveservices.search.websearch.models.error_response_py3.ErrorResponseException:操作返回無效的狀態代碼“找不到資源”
知道為什么它不起作用嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.