我正在使用api.ai的python SDK。我在coporate代理后面工作,我也获得了443端口的防火墙访问权限。我可以调用其他外部API,如wt.ai.但是我不能称之为api.ai的API。
ai = apiai.ApiAI(CLIENT_ACCESS_TOKEN)
request = ai.text_request()
request.lang = 'en' # optional, default value equal 'en'
request.session_id = "<SESSION ID, UNIQUE FOR EACH USER>"
request.query = "Hello"
response = request.getresponse()
print (response.read())
我收到了以下错误:
Traceback (most recent call last):
File "DialogAssistant.py", line 44, in <module>
main()
File "DialogAssistant.py", line 38, in main
response = request.getresponse()
File "C:\Users\chathuranga_08290\AppData\Local\Continuum\Anaconda3\lib\site-packages\apiai\requests\request.py", line 128, in getresponse
self._connect()
File "C:\Users\chathuranga_08290\AppData\Local\Continuum\Anaconda3\lib\site-packages\apiai\requests\request.py", line 82, in _connect
self._connection.connect()
File "C:\Users\chathuranga_08290\AppData\Local\Continuum\Anaconda3\lib\http\client.py", line 1400, in connect
server_hostname=server_hostname)
File "C:\Users\chathuranga_08290\AppData\Local\Continuum\Anaconda3\lib\ssl.py", line 401, in wrap_socket
_context=self, _session=session)
File "C:\Users\chathuranga_08290\AppData\Local\Continuum\Anaconda3\lib\ssl.py", line 808, in __init__
self.do_handshake()
File "C:\Users\chathuranga_08290\AppData\Local\Continuum\Anaconda3\lib\ssl.py", line 1061, in do_handshake
self._sslobj.do_handshake()
File "C:\Users\chathuranga_08290\AppData\Local\Continuum\Anaconda3\lib\ssl.py", line 683, in do_handshake
self._sslobj.do_handshake()
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
如何解决这个问题?