This commit is contained in:
parent
d6c2e60f16
commit
5cd35ed031
|
@ -32,7 +32,7 @@ def create_app():
|
|||
logger.info(f"Request Path: {request.path}")
|
||||
logger.info(f"Request Method: {request.method}")
|
||||
logger.info(f"Request Headers: {request.headers}")
|
||||
logger.info(f"Request Headers: {request.args}")
|
||||
logger.info(f"Request args: {request.args}")
|
||||
logger.info(f"Request Body: {request.get_data(as_text=True)}")
|
||||
|
||||
# routes
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
from datetime import datetime
|
||||
|
||||
import iso8601
|
||||
from flask import Blueprint, jsonify, request
|
||||
from flask_jwt_extended import get_jwt_identity, jwt_required
|
||||
|
||||
|
@ -15,7 +17,7 @@ query_bp = Blueprint('query', __name__)
|
|||
def queryTrains():
|
||||
from_station = request.args.get('from')
|
||||
to_station = request.args.get('to')
|
||||
date = datetime.strptime(request.args.get('date'), "%Y-%m-%dT%H:%M:%S")
|
||||
date = iso8601.parse_date(request.args.get('date'))
|
||||
if not from_station or not to_station or not date:
|
||||
return jsonify(create_response(StateCode.PARAMS_ERROR)), 400
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ class TrainPresenter:
|
|||
return {
|
||||
"id": self.data.id,
|
||||
"trainNo": self.data.train_no,
|
||||
"expirationTime": self.data.expiration_time,
|
||||
"effectiveTime": self.data.effective_time,
|
||||
"arrivalTime": self.data.arrival_time,
|
||||
"departureTime": self.data.departure_time,
|
||||
"arrivalStation": self.data.arrival_station,
|
||||
"departureStation": self.data.departure_station,
|
||||
"trainStations": [TrainStationPresenter(station).as_dict() for station in self.data.train_stations]
|
||||
|
|
|
@ -17,4 +17,5 @@ Levenshtein==0.25.1
|
|||
munkres==1.1.4
|
||||
argparse==1.4.0
|
||||
flask-cors==4.0.1
|
||||
loguru
|
||||
loguru
|
||||
iso8601
|
Loading…
Reference in New Issue