def create_game(game): """ Create game object from Steam API call """ from games.models import Game slug = slugify(game['name'])[:50] LOGGER.info("Adding %s to library" % game['name']) steam_game = Game( name=game['name'], steamid=game['appid'], slug=slug, ) if game['img_logo_url']: steam_game.get_steam_logo(game['img_logo_url']) steam_game.get_steam_icon(game['img_icon_url']) try: steam_game.save() except Exception as ex: LOGGER.error("Error while saving game %s: %s", game, ex) raise return steam_game