0
我使用recastai寫FB機器人,我下面這個樣本https://recast.ai/docs/api-reference/#request-text,我寫了這個代碼來分析文本連接燒瓶recastai阿比
from flask import Flask
import recastai
app = Flask(__name__)
@app.route('/')
def home():
request = recastai.Request('TOKEN')
response = request.analyse_text('Hello')
return 'hello'
輸出頁面顯示「內部服務器錯誤」和錯誤日誌顯示導入錯誤,但它僅出現後,我加入響應行
2017-12-03 05:41:16,767:
***************************************************
2017-12-03 06:48:14,534: Error running WSGI application
2017-12-03 06:48:14,555: requests.exceptions.ProxyError: HTTPSConnectionPool(host='api.recast.ai', port=443): Max retries exceeded with url: /v2/request (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden',)))
2017-12-03 06:48:14,555: File "/var/www/tarekhassan_pythonanywhere_com_wsgi.py", line 16, in <module>
2017-12-03 06:48:14,556: from hello import app as application
2017-12-03 06:48:14,556:
2017-12-03 06:48:14,556: File "/home/tarekhassan/bot/hello.py", line 7, in <module>
2017-12-03 06:48:14,556: def home():
2017-12-03 06:48:14,556:
2017-12-03 06:48:14,556: File "/home/tarekhassan/.local/lib/python3.5/site-packages/recastai/apis/request/analyse.py", line 27, in analyse_text
2017-12-03 06:48:14,556: headers={'Authorization': "Token {}".format(token)}
2017-12-03 06:48:14,556:
2017-12-03 06:48:14,556: File "/usr/local/lib/python3.5/dist-packages/requests/api.py", line 111, in post
2017-12-03 06:48:14,557: return request('post', url, data=data, json=json, **kwargs)
2017-12-03 06:48:14,557:
2017-12-03 06:48:14,557: File "/usr/local/lib/python3.5/dist-packages/requests/api.py", line 57, in request
2017-12-03 06:48:14,557: return session.request(method=method, url=url, **kwargs)
2017-12-03 06:48:14,557:
2017-12-03 06:48:14,557: File "/usr/local/lib/python3.5/dist-packages/requests/sessions.py", line 475, in request
2017-12-03 06:48:14,557: resp = self.send(prep, **send_kwargs)
2017-12-03 06:48:14,558:
2017-12-03 06:48:14,558: File "/usr/local/lib/python3.5/dist-packages/requests/sessions.py", line 585, in send
2017-12-03 06:48:14,558: r = adapter.send(request, **kwargs)
2017-12-03 06:48:14,558:
2017-12-03 06:48:14,558: File "/usr/local/lib/python3.5/dist-packages/requests/adapters.py", line 465, in send
2017-12-03 06:48:14,558: raise ProxyError(e, request=request)
2017-12-03 06:48:14,559: ***************************************************
2017-12-03 06:48:14,559: If you're seeing an import error and don't know why,
2017-12-03 06:48:14,559: we have a dedicated help page to help you debug:
2017-12-03 06:48:14,559: https://help.pythonanywhere.com/pages/DebuggingImportError/
請添加完整的錯誤追蹤您的問題! –
添加了錯誤跟蹤 –
您的代理存在問題。 –