Exemple #1
0
def create():
    crs1 = fuzzy_match(request.form["from"])[0]
    crs2 = fuzzy_match(request.form["to"])[0]
    when = request.form["when"]
    api_put(crs1, crs2, when, fake_ip="micky mouse")
    newurl = "/{}/{}/{}".format(crs1, crs2, when)

    data = api_get(crs1, crs2, when)
    return render_template("journey.html", **data)
Exemple #2
0
def create():
    crs1 = fuzzy_match(request.form["from"])[0]
    crs2 = fuzzy_match(request.form["to"])[0]
    when = request.form["when"]
    api_put(crs1, crs2, when, fake_ip="micky mouse")
    newurl = "/{}/{}/{}".format(crs1, crs2, when)

    data = api_get(crs1, crs2, when)
    return render_template("journey.html", **data)
Exemple #3
0
def api(crs1, crs2, when="now"):
    crs1 = fuzzy_match(crs1)[0]
    crs2 = fuzzy_match(crs2)[0]

    if request.method == "PUT":
        api_put(crs1, crs2, when)

    data = api_get(crs1, crs2, when)
    if request_wants_json():
        return jsonify(data)
    else:
        return render_template("journey.html", **data)
Exemple #4
0
def api(crs1, crs2, when="now"):
    crs1 = fuzzy_match(crs1)[0]
    crs2 = fuzzy_match(crs2)[0]

    if request.method == "PUT":
        api_put(crs1, crs2, when)

    data = api_get(crs1, crs2, when)
    if request_wants_json():
        return jsonify(data)
    else:
        return render_template("journey.html", **data)