nack43 / line-bot

0 stars 1 forks source link

throws internal server when it cant find any blogs #16

Open djentleman opened 7 years ago

djentleman commented 7 years ago

使ったcurlは:

curl -k -H "Content-Type: application/json" -X POST -d '{"events": [{"replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA","type": "message","timestamp": 1462629479859,"source": {"type": "user","userId": "U206d25c2ea6bd87c17655609a1c37cb8"},"message": {"id": "325708","type": "text","text": "ジャンゴのブロクを見つけて"}}]}' https://ec2-34-227-224-6.compute-1.amazonaws.com/blogsearch/1.0

hugのlogは:

LEYS TOKENIZE JAPANESE!
['', '']
Traceback (most recent call last):
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "/home/ubuntu/line-bot/venv/lib/python3.5/site-packages/falcon/api.py", line 227, in __call__
    responder(req, resp, **params)
  File "/home/ubuntu/line-bot/venv/lib/python3.5/site-packages/hug/interface.py", line 659, in __call__
    self.render_content(self.call_function(input_parameters), request, response, **kwargs)
  File "/home/ubuntu/line-bot/venv/lib/python3.5/site-packages/hug/interface.py", line 600, in call_function
    return self.interface(**parameters)
  File "/home/ubuntu/line-bot/venv/lib/python3.5/site-packages/hug/interface.py", line 99, in __call__
    return __hug_internal_self._function(*args, **kwargs)
  File "get_article.py", line 89, in blog_search_post_endpoint_10
    articles = find_articles(message, lang)
  File "get_article.py", line 62, in find_articles
    for item in res['items']:
KeyError: 'items'
djentleman commented 7 years ago

たぶんブログを見つけなかったから、空いてる配列があって、エラーする