擅长:python、mysql、java
<p>要做的第一件事是将异常处理放在处理错误的JSON请求数据(这可能就是正在发生的事情)类似于</p>
<pre><code>def getSinglePrediction(self, route, busStop):
try:
prediction = self.predictor.getPredictionForStop(route, busStop)
return jsonify({'busStop': busStop, 'prediction': prediction})
except:
return jsonify({'busStop': 'error', 'prediction': 'error'})
</code></pre>