我正在尝试将Kairos示例代码(http://docs.kairosv1.apiary.io/#reference/face-recognition/enroll/post)用于我的家庭计算机,但它给了我这个错误:
File "C:\Python27\lib\urllib2.py", line 556, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 403: Forbidden
这是我的代码:
from urllib2 import Request, urlopen
values = """
{
"image": "http://media.kairos.com/kairos-elizabeth.jpg",
"subject_id": "Elizabeth",
"gallery_name": "MyGallery"
}
"""
headers = {
'Content-Type': 'application/json',
'app_id': 'd0dd238e',
'app_key': 'f4828ade9a868af6365d982e5822f2d1s'
}
request = Request('https://api.kairos.com/enroll', data=values, headers=headers)
response_body = urlopen(request).read()
print response_body
提前致谢!
答案 0 :(得分:0)
有关详细信息,请查看此帖:urllib2.HTTPError: HTTP Error 403: Forbidden