def steamid_appid(steam_id=None, app_id=None):
    print("Connecting to Steam API server and populating friends...")
    me = MySteamFriends(
        api_key=API_KEY,
        steam_id=steam_id,
        debugging=DEBUG,
        concurrent_api=CONCURRENT_API)

    print("Connected, collecting friends in-game time...")
    all_game_stats = me.get_everyones_gamestats(app_id)

    print("Done, looking up steam usernames...")
    all_game_stats_detailed = me.get_game_stats_detailed(all_game_stats)

    return render_template('steamid_appid.html',
                           game_stats_detailed=all_game_stats_detailed,
                           appid=app_id,
                           steamuser=me.get_steam_user(me.my_steam_id),
                           total_gametime=me.total_gametime,
                           total_games=len(me.my_games_list),
                           game_title=me.get_game_name(app_id))
def username(user_identifier=None):
    if 17 <= len(user_identifier) <= 18 and user_identifier.isdigit():
        steam_username = None
        steam_id = user_identifier
    else:
        steam_username = user_identifier
        steam_id = None

    print("Connecting to Steam API server and populating friends...")
    me = MySteamFriends(
        api_key=API_KEY,
        steam_username=steam_username,
        steam_id=steam_id,
        debugging=DEBUG)



    return render_template('games_list.html',
                           games_list=me.my_games_list,
                           steamid=me.my_steam_id,
                           total_gametime=me.total_gametime,
                           total_games=len(me.my_games_list),
                           steamuser=me.get_steam_user(me.my_steam_id))