2025-02-03 02:36:54 -03:00
|
|
|
from flask import Blueprint, jsonify
|
|
|
|
from tpmcqr_service import redis_client
|
2025-02-03 03:15:16 -03:00
|
|
|
from tpmcqr_service.api.utils import calcula_distancias_parada
|
2025-02-03 04:16:15 -03:00
|
|
|
from time import monotonic
|
2025-02-03 02:36:54 -03:00
|
|
|
|
2025-02-03 03:26:23 -03:00
|
|
|
apiv2 = Blueprint('apiv2', __name__)
|
2025-02-03 02:36:54 -03:00
|
|
|
|
2025-02-03 03:23:27 -03:00
|
|
|
@apiv2.route('/api_v2/<string:parada>')
|
|
|
|
def info_parada(parada=None):
|
2025-02-03 04:16:15 -03:00
|
|
|
from time import monotonic
|
2025-02-03 02:36:54 -03:00
|
|
|
current_file = redis_client.get('current_file')
|
|
|
|
status, salida_parada = calcula_distancias_parada(current_file, parada)
|
2025-02-03 04:16:15 -03:00
|
|
|
salida_parada['compute_time'] = monotonic() - start_time
|
2025-02-03 03:23:27 -03:00
|
|
|
return jsonify(salida_parada), status# from tpmcqr_service.errors.handlers import errors
|