import requests
import logging


def get_news_from_steamNetAPI(game_id):
    """
        This is the function that gets the latest news of a game from the Steam API.

    Params:
        game_id - Integer

    Returns:
        List - Contains 3 dictionaries with the 'actual' news.
    """
    try:
        game_news_api_link = 'http://api.steampowered.com/ISteamNews/GetNewsForApp/v0002/?appid='+game_id+'&count=3&maxlength=300&format=json'
        req_ = requests.get(game_news_api_link)
        recived_json = req_.json()

        appnews_ = recived_json.get("appnews")
        news_ = appnews_.get("newsitems")

        return news_
    except Exception as exc:
        logging.warning('Unexpected exception!')
        logging.exception('Execption in get_news_from_steamNetAPI')