コード例 #1
0
def vehical_visits():
    logger.debug("post request ")
    data = request.json
    store.add(data)
    rabbit_mqueue.connect()
    rabbit_mqueue.publish_message(json.dumps(data))
    return json.dumps({"id": data["id"]})
コード例 #2
0
def vehical_update_shortest_path(vehical_id):
    shortest_path = request.json['shortest_path']
    output = store.update(vehical_id, 'shortest_path', shortest_path)
    logger.debug(output)
    return json.dumps(output)
コード例 #3
0
def vehical_path(vehical_id):
    logger.debug(f"vehical path requested {vehical_id}")
    return json.dumps(store.get(vehical_id))
コード例 #4
0
 def get(self, vehical_id):
     logger.debug(f"vehical_data = {self.vehical_data}")
     for vdata in self.vehical_data:
         if vdata["id"] == int(vehical_id):
             return vdata
     return {}
コード例 #5
0
 def publish_message(self, message):
     logger.debug(message)
     self.channel.basic_publish(exchange=self.exchange,
                                routing_key=self.queue,
                                body=message)
コード例 #6
0
ファイル: publisher_api.py プロジェクト: charan678/tspapp
def vehical_update_shortest_path(vehical_id):
    shortest_path = request.json['shortest_path']
    logger.info(f"shortest path is = {shortest_path} for vehical = {vehical_id}")
    output = store.update(vehical_id, 'shortest_path', shortest_path)
    logger.debug(f"output = {output}")
    return json.dumps(output)