aipFace = AipFace('xxxx', 'fffff', 'aaaaa')
groupIdList = "test"
""" 如果有可选参数 """
options = {}
options["quality_control"] = "NORMAL"
options["liveness_control"] = "NONE"
options["max_user_num"] = 2
""" 带参数调用人脸搜索 """
aipFace.search(image, ‘BASE64’, groupIdList,options);
直接报异常:
File "/usr/local/lib/python2.7/dist-packages/aip/face.py", line 83, in search
'Content-Type': 'application/json',
File "/usr/local/lib/python2.7/dist-packages/aip/base.py", line 98, in _request
), proxies=self._proxies
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 112, in post
return request('post', url, data=data, json=json, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 440, in send
timeout=timeout
File "/usr/local/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 601, in urlopen
chunked=chunked)
File "/usr/local/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 357, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python2.7/httplib.py", line 1042, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.7/httplib.py", line 1082, in _send_request
self.endheaders(body)
File "/usr/lib/python2.7/httplib.py", line 1038, in endheaders
self._send_output(message_body)
File "/usr/lib/python2.7/httplib.py", line 886, in _send_output
self.send(message_body)
File "/usr/lib/python2.7/httplib.py", line 858, in send
self.sock.sendall(data)
File "/usr/local/lib/python2.7/dist-packages/urllib3/contrib/pyopenssl.py", line 316, in sendall
sent = self._send_until_done(data[total_sent:total_sent + SSL_WRITE_BLOCKSIZE])
File "/usr/local/lib/python2.7/dist-packages/urllib3/contrib/pyopenssl.py", line 304, in _send_until_done
return self.connection.send(data)
File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 1256, in send
self._raise_ssl_error(self._ssl, result)
File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 1174, in _raise_ssl_error
_raise_current_error()
File "/usr/lib/python2.7/dist-packages/OpenSSL/_util.py", line 48, in exception_from_error_queue
raise exception_type(errors)
Error: [('SSL routines', 'ssl3_write_pending', 'bad write retry')]
bad write retry 我觉得还是写法上的问题 并不是接口调用问题