def get(self): parser = reqparse.RequestParser() parser.add_argument('task_type') parser.add_argument('confirmed') args = parser.parse_args() task_type = args['task_type'] confirmed = args['confirmed'] print 'task_type:', task_type, 'confirmed:', confirmed t = time.clock() response = self.sender.sync_send(Message(content={ 'task_type': task_type, 'confirmed': confirmed, }, correlation_id='task_list'), timeout=3) print 'get cost time: {}'.format(time.clock() - t) if response: try: resp = make_response(zlib.decompress(response.content)) resp.headers['content-type'] = 'text/plain' return resp except: pass abort(404, message="fetch research task list failed.")
def delete(self, task_id): task_list = [task_id] self.sender.send( Message(content=json.dumps(task_list), correlation_id='task_delete')) # response = sender.sync_send(Message(content=json.dumps(task_list), correlation_id='task_delete'), timeout=3) # update_list = json.loads(response.content) return '', 202
def post(self): parser = reqparse.RequestParser() parser.add_argument('investable_bond_list', type=list, location='json') args = parser.parse_args() print args investable_bond_list = args['investable_bond_list'] self.sender.send( Message(content=json.dumps(investable_bond_list), correlation_id='investment_pool_add')) return '', 202
def post(self): parser = reqparse.RequestParser() parser.add_argument('task_list', type=list, location='json') args = parser.parse_args() print args task_list = args['task_list'] self.sender.send( Message(content=json.dumps(task_list), correlation_id='task_add')) # response = sender.sync_send(Message(content=json.dumps(task_list), correlation_id='task_add'), timeout=3) # update_list = json.loads(response.content) return '', 202
def put(self, key): parser = reqparse.RequestParser() parser.add_argument('bonds', type=list, location='json') args = parser.parse_args() print args investable_bond = args['bonds'] investable_bond['key'] = key investable_bond_list = [investable_bond] self.sender.send( Message(content=json.dumps(investable_bond_list), correlation_id='investment_pool_update')) return '', 202
def put(self, order_id): parser = reqparse.RequestParser() parser.add_argument('order', type=list, location='json') args = parser.parse_args() print args order = args['order'] order['order_id'] = order_id order_list = [order] self.sender.send( Message(content=json.dumps(order_list), correlation_id='money_order_update')) return '', 202
def put(self, task_id): parser = reqparse.RequestParser() parser.add_argument('task', type=list, location='json') args = parser.parse_args() print args task = args['task'] task['task_id'] = task_id task_list = [task] self.sender.send( Message(content=json.dumps(task_list), correlation_id='manager_task_update')) return '', 202
def get(self): t = time.clock() response = self.sender.sync_send(Message(correlation_id='order_list'), timeout=3) print 'get cost time: {}'.format(time.clock() - t) if response: try: resp = make_response(zlib.decompress(response.content)) resp.headers['content-type'] = 'text/plain' return resp except: pass abort(404, message="fetch money order list failed.")
def get(self, key): t = time.clock() response = self.sender.sync_send(Message(content={'key': key}, correlation_id='demo1'), timeout=3) print 'get cost time: {}'.format(time.clock() - t) if response: try: resp = make_response(zlib.decompress(response.content)) resp.headers['content-type'] = 'text/plain' return resp except: pass abort(404, message="Demo1: get method failed.")
def get(self, task_id): t = time.clock() response = self.sender.sync_send(Message(content={'task_id': task_id}, correlation_id='single_task'), timeout=3) print 'get cost time: {}'.format(time.clock() - t) if response: try: resp = make_response(zlib.decompress(response.content)) resp.headers['content-type'] = 'text/plain' return resp except: pass abort(404, message="fetch manager bond task failed.")
def get(self, bond_key_listed_market): t = time.clock() response = self.sender.sync_send(Message( content={'bond_key_listed_market': bond_key_listed_market}, correlation_id='bond'), timeout=3) print 'get cost time: {}'.format(time.clock() - t) if response: try: resp = make_response(zlib.decompress(response.content)) resp.headers['content-type'] = 'text/plain' return resp except: pass abort(404, message="fetch bond info failed.")
def post(self): parser = reqparse.RequestParser() parser.add_argument('filter_params', type=dict, location='json') args = parser.parse_args() filter_params = args['filter_params'] t = time.clock() response = self.sender.sync_send(Message( content=json.dumps(filter_params), correlation_id='import'), timeout=30) print 'get cost time: {}'.format(time.clock() - t) if response: try: resp = make_response(zlib.decompress(response.content)) resp.headers['content-type'] = 'text/plain' return resp except: pass abort(404, message="fetch account cash failed.")
def get(self): parser = reqparse.RequestParser() parser.add_argument('bond_key_listed_market') args = parser.parse_args() bond_key_listed_market = args['bond_key_listed_market'] print 'bond_key_listed_market:', bond_key_listed_market t = time.clock() response = self.sender.sync_send(Message( content={'bond_key_listed_market': bond_key_listed_market}, correlation_id='order_list'), timeout=3) print 'get cost time: {}'.format(time.clock() - t) if response: try: resp = make_response(zlib.decompress(response.content)) resp.headers['content-type'] = 'text/plain' return resp except: pass abort(404, message="fetch secondary order list failed.")
def get(self): parser = reqparse.RequestParser() parser.add_argument('investable') args = parser.parse_args() investable = args['investable'] print 'investable:', investable t = time.clock() response = self.sender.sync_send(Message( content={'investable': investable}, correlation_id='investment_pool'), timeout=3) print 'get cost time: {}'.format(time.clock() - t) if response: try: resp = make_response(zlib.decompress(response.content)) resp.headers['content-type'] = 'text/plain' return resp except: pass abort(404, message="fetch investable bond list failed.")
def get(self): parser = reqparse.RequestParser() parser.add_argument('type') parser.add_argument('status') args = parser.parse_args() task_type = args['type'] status = args['status'] t = time.clock() response = self.sender.sync_send(Message(content={ 'task_type': task_type, 'status': status, }, correlation_id='demo2_get'), timeout=3) print 'get cost time: {}'.format(time.clock() - t) if response: try: resp = make_response(zlib.decompress(response.content)) resp.headers['content-type'] = 'text/plain' return resp except: pass abort(404, message="Demo2: get method failed.")
def delete(self, order_id): order_list = [order_id] self.sender.send( Message(content=json.dumps(order_list), correlation_id='money_order_delete')) return '', 202
def delete(self, task_id): task_list = [task_id] self.sender.send( Message(content=json.dumps(task_list), correlation_id='manager_task_delete')) return '', 202
def delete(self, bond_key_listed_market): investable_bond_list = [bond_key_listed_market] self.sender.send( Message(content=json.dumps(investable_bond_list), correlation_id='investment_pool_delete')) return '', 202