Ejemplo n.º 1
0
def get_raw_json(game_id: str) -> dict:
    url = NHLAPI + 'game/{}/feed/live'.format(game_id)
    res = get_page(url)

    try:
        json_res = loads(res)
        return json_res
    except Exception:
        return None
Ejemplo n.º 2
0
def get_raw_html(game_id: str):
    """
    Gets the raw Roster HTML from htmlreports.

    :param game_id:
    :return:
    """
    url = HTMLREPORTS + '{}{}/PL{}.HTM'.format(game_id[:4], int(game_id[:4]) + 1, game_id[4:])
    res = common.get_page(url)

    assert res is not None
    return res
Ejemplo n.º 3
0
def get_raw_json(game_id: str) -> dict:
    """
    Given a game_id it returns the raw json
    :param game_id: the game

    :return: json or None
    """
    url = SHIFTS + game_id
    res = common.get_page(url)

    try:
        json_res = loads(res)
        return json_res
    except Exception as e:
        # log exception
        return None
Ejemplo n.º 4
0
def get_raw_json(date_from: str, date_to: str):
    """
    Get the raw JSON for a date range

    :param date_from:
    :param date_to:
    :return:
    """
    url = NHLAPI + 'schedule?startDate={}&endDate={}'.format(
        date_from, date_to)
    res = common.get_page(url)

    try:
        json_res = loads(res)
        return json_res
    except Exception as e:
        # log exception
        return None
Ejemplo n.º 5
0
def get_raw_json(game_id: str) -> dict:
    """
    Given a game_id it returns the raw json
    :param game_id: the game

    :return: json or None
    """
    url = NHLAPI_URL + 'game/' + game_id + '/boxscore'
    res = common.get_page(url)

    try:
        json_res = loads(res)
        json_res[
            'GAME_ID'] = game_id  #boxscore doesnt have the game_id anywhere...and i want my function calls to be clean
        return json_res
    except Exception as e:
        # log exception
        return None