Пример #1
0
def char_search(wowrealm, wowcharacter):
    realmlist = SQLfetcher.SQLfetchRealm()
    realmlist_l = SQLfetcher.SQLfetchRealmLower()
    if (all(c.isalpha() for c in wowcharacter) and len(wowcharacter) < 13
            and len(wowcharacter) > 1 and wowrealm in realmlist_l):
        try:
            char_profile = wowdata.get_character("eu", wowrealm, wowcharacter,
                                                 "gear")
            SQLfetcher.SQLinsert(char_profile, "WEB")
            return render_template(
                "lookup.html",
                char_data=char_profile,
                realm_data=realmlist,
                color_class=css_wow_class,
                selection="lookup",
                nav=navi,
            )
        except:
            return render_template(
                "lookup.html",
                realm_data=realmlist,
                err_msg="Character not found!",
                selection="lookup",
                nav=navi,
            )
    else:
        return render_template(
            "lookup.html",
            realm_data=realmlist,
            err_msg="Invalid input!",
            selection="lookup",
            nav=navi,
        )
Пример #2
0
def get_token_info():
    token_info = SQLfetcher.SQLtokenFetchCurrent()
    token_history = SQLfetcher.SQLtokenFetchHistory()
    token_month_high = SQLfetcher.SQLtokenFetchMonthHigh()
    return render_template(
        "gold_token.html",
        data=token_info,
        data1=token_history,
        data2=token_month_high,
        title="Token",
        selection="token",
        nav=navi,
    )
Пример #3
0
def get_wow_character():
    if (not "region" in request.json or not "realm" in request.json
            or not "character" in request.json):
        abort(400)
    api_region = request.json["region"]
    api_realm = request.json["realm"]
    api_character = request.json["character"]

    if (not all(c.isalpha() for c in api_character)
            or not api_realm.lower() in SQLfetcher.SQLfetchRealmLower()
            or not api_region.lower() in ["us", "eu"]):
        abort(400)

    try:
        api_profile = myAPI.get_character(api_region, api_realm, api_character)
        SQLfetcher.SQLinsert(api_profile, "API")
    except:
        api_profile = {"error": "Character not found"}
    return jsonify(api_profile), 200
Пример #4
0
def output():
    thumbnail = []
    g_char = SQLfetcher.SQLfetch()
    count = 0
    for x in g_char:
        if x[3] == "none":
            thumbnail.append(no_thumb)
        else:
            thumbnail.append(thumb + x[3])
        count += 1
    return render_template("toplist.html",
                           rank_list=g_char,
                           thumb=thumbnail,
                           title="Toplist",
                           nav=navi)
Пример #5
0
def roster_list():
    fetch_class = "all"
    if request.method == "POST":
        if (request.form["sort_class"] in player_classes
                and request.form["sort_class"].isalnum()):
            fetch_class = player_classes[request.form["sort_class"]]

    g_roster = SQLfetcher.SQLfetchAll(fetch_class)
    return render_template(
        "roster.html",
        data=g_roster,
        color_class=css_wow_class,
        title="Roster",
        selection="roster",
        nav=navi,
    )
Пример #6
0
def get_roster():
    api_roster = SQLfetcher.SQLfetchAll("all")
    return jsonify(api_roster)
Пример #7
0
def get_searches():
    searchlist = SQLfetcher.SQLfetchSearch()
    return render_template("searchstat.html", data=searchlist)
Пример #8
0
def char_lookup():
    realmlist = SQLfetcher.SQLfetchRealm()
    return render_template("lookup.html",
                           realm_data=realmlist,
                           selection="lookup",
                           nav=navi)