Esempio n. 1
0
def game_details(game_number, eaid):
    """last results for last games for team"""
    url = get_api_url(eaid, 'matches')
    json = get_content(url)
    index = game_number - 1
    games = parse_results_data(json, eaid)
    if index < len(games):
        return games[index]
    return None
Esempio n. 2
0
def find_teams(abbreviation):
    search_url = create_search_url(abbreviation)
    temp = []
    html = get_content(search_url)
    teams = get_teams_from_search_page(html)
    if not teams:
        return None
    for data in teams:
        team = {'url': data['url'], 'name': data['name'], 'ea_id': _get_eaid_from_url(data['url'])}
        temp.append(team)
    return temp
Esempio n. 3
0
def last_games(amount, team=None, eaid=None):
    """Pretty print results of last games for team"""
    temp = ""
    if team:
        teamid = team.eaid
    elif eaid:
        teamid = eaid
    else:
        return None
    url = get_results_url(teamid)
    html = get_content(url)
    results = parse_results_data(html, teamid)
    for result in results[0:amount]:
        temp += result['summary'] + ' (' + result['when'] + ')' + ' | '
    return temp.strip()[:-1].strip()
Esempio n. 4
0
def get_team_overview_json(team_name):
    """Return team overview from ea server. Stores team data to db,
    if not already found from there"""
    content = get_content('http://www.easports.com/iframe/nhl14proclubs/api/platforms/' + \
                          eashltoolkit.settings.SYSTEM + '/clubsComplete/' + _replace_space_with_url_encode(team_name))
    return content
Esempio n. 5
0
def get_players(eaid, ids):
    postfix = 'members/' + ','.join(map(str, ids)) + '/stats'
    url = get_api_url(eaid, postfix)
    url = url.replace('clubs/' + eaid, '')
    players_json = get_content(url)
    return parse_player_data(players_json)
Esempio n. 6
0
def get_ids(eaid):
    url = get_api_url(eaid, 'members')
    team_members_json = get_content(url)
    return get_player_ids(team_members_json)