southeastasia.api.cognitive.microsoft.com无法正常工作

时间:2019-06-07 14:40:09

标签: azure-cognitive-services

import http.client, urllib.request, urllib.parse, urllib.error, base64

headers = {
    # Request headers
    'Content-Type': 'application/json',
    'Ocp-Apim-Subscription-Key': '{subscription key}',
}

params = urllib.parse.urlencode({
    # Request parameters
    'returnFaceId': 'true',
    'returnFaceLandmarks': 'false',
    'returnFaceAttributes': '{string}',
    'recognitionModel': 'recognition_01',
    'returnRecognitionModel': 'false',
})

try:
    conn =http.client.HTTPSConnection('southeastasia.api.cognitive.microsoft.com')
    conn.request("POST", "/face/v1.0/detect?%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))

上面的代码不起作用。

我给了正确的1key1值

我得到:

  

[Errno 11002] getaddrinfo失败

0 个答案:

没有答案