Example #1
0
def api_search(params):
    if 'keyword' in params:
        keyword = params['keyword']
        search_result = yield search_product(keyword)
        raise gen.Return(result(200, 'success', search_result))
    else:
        raise gen.Return(result(400, 'fail', {'error': 'bad request'}))
Example #2
0
 def _search_test(self):
     products = yield search_product('娃娃')
     self.assertEqual(products['status'], "success")
     print products
     self.assertTrue(True)
     ioloop.IOLoop.instance().stop()