Example #1
0
def getSteamLibrary(apiKey: str, steamID: int) -> list:
    try:
        api = WebAPI(apiKey, https=True)
    except HTTPError:
        raise PermissionError("403 Client Error: Forbidden.\nWrong API key?")
    else:
        games = api.call("IPlayerService.GetOwnedGames",
                         steamid=steamID,
                         include_appinfo=1,
                         include_played_free_games=1,
                         include_free_sub=0,
                         appids_filter="name")
        if len(games["response"]) == 0:
            raise ValueError("No games found. Wrong SteamID?")
        else:
            gamelist = []
            for game in games["response"]["games"]:
                gamelist.append({
                    "platform": "Steam",
                    "name": game["name"],
                    "region": "Steam",
                    "code": str(game["appid"]),
                    "game": "Yes",
                    "box": "Yes",
                    "manual": "Yes",
                    "year": "",
                    "genre": "",
                    "comment": "",
                    "publisher": "",
                    "developer": "",
                    "platforms": "",
                    "price": "$0,$0,$0,$0"
                })

            return gamelist
Example #2
0
def get_owned(api: WebAPI, steamid: str):
    return api.call(
        "IPlayerService.GetOwnedGames",
        steamid=steamid,
        include_appinfo=True,
        include_played_free_games=False,
        appids_filter=[],
        include_free_sub=False
    )["response"]["games"]
Example #3
0
class Connector:
    def __init__(self):
        self.api = WebAPI(STEAM_KEY)

    def get_list(self) -> Iterator[dict]:

        # TODO: c'e' modo di escludere schifezze tipo i mod, le beta, e anche i film?

        res = self.api.call("IPlayerService.GetOwnedGames",
                            steamid=STEAM_PLAYER_ID,
                            include_appinfo=True,
                            include_played_free_games=True,
                            appids_filter=None)

        # TODO: gestire fallimento

        for game in res['response']['games']:
            yield {
                'service': Service.STEAM,
                'key': str(game['appid']),
                'name': game['name'],
                'validation': Validation.TODO
            }
Example #4
0
def get_user_summary(api: WebAPI, steamid: str):
    return api.call(
        "ISteamUser.GetPlayerSummaries",
        steamids=steamid
    )["response"]["players"][0]
Example #5
0
def call_steamapi(*args, **kwargs):
    """Perform Steam API call"""
    api = WebAPI(key=args[0])
    return api.call(args[1], **kwargs)