我正在尝试使用Microsoft Arezu情感API测试一些图像。按照microsoft上的说明,我得到{" statusCode":404," message":"资源未找到"一直都是错误的。我的代码从网站上修改如下:
########### Python 2.7 #############
import httplib, urllib, base64
headers = {
# Request headers. Replace the placeholder key below with your subscription key.
'Content-Type': 'application/json',
'Ocp-Apim-Subscription-Key': 'key',
}
params = urllib.urlencode({ })
# Replace the example URL below with the URL of the image you want to analyze.
body = "{ 'url':'http://www.scientificamerican.com/sciam/cache/file/35391452-5457-431A-A75B859471FAB0B3.jpg' }"
try:
# NOTE: You must use the same region in your REST call as you used to obtain your subscription keys.
# For example, if you obtained your subscription keys from westcentralus, replace "westus" in the
# URL below with "westcentralus".
conn = httplib.HTTPSConnection('westcentralus.api.cognitive.microsoft.com')
conn.request("POST", "/emotion/v1.0/recognize?%s" % params, body, headers)
response = conn.getresponse()
data = response.read()
print(data)
conn.close()
except Exception as e:
print("[Errno {0}] {1}".format(e.errno, e.strerror))
此外,当我在浏览器中输入端点网址https://westus.api.cognitive.microsoft.com/emotion/v1.0时,它会显示{"错误":{"代码":"资源注意事项& #34;,"消息":"未找到资源。" }。我不确定这是否与错误有关。
有没有人遇到这个问题,或者有人能给我一些解决问题的建议吗?谢谢!
答案 0 :(得分:0)
我也遇到了同样的问题,无论您收到什么状态代码和错误消息
<块引用>[message:protected] => 失败: 代码:404 值:未找到 详细信息(如果有):找不到“工作”细分的资源..
检查您的参数,如果您将已处理的 JobId 和所有内容传递给 azure。然后你会得到这个问题。您需要交叉检查您传递的文件信息是否已被处理。
谢谢!
答案 1 :(得分:-1)