How to use the steam.api.interface function in steam

To help you get started, we’ve selected a few steam examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Lagg / steamodd / tests / testuser.py View on Github external
def test_sids(self):
        ID64 = 76561198014028523

        profile_batch_friends = api.interface("ISteamUser").GetFriendList(steamid = ID64)
        profile_batch_testsids = [friend["steamid"] for friend in profile_batch_friends["friendslist"]["friends"]]
        friend_list = user.friend_list(ID64)

        self.assertEqual(set(profile_batch_testsids), set(map(lambda x: str(x.steamid), friend_list)))
github FAForever / server / steam / user.py View on Github external
def __next__(self):
        for batch in self._batches:
            req = api.interface("ISteamUser").GetPlayerSummaries(version = 2, steamids = ','.join(batch))

            for player in req["response"]["players"]:
                yield profile.from_def(player)
    next = __next__
github Lagg / steamodd / steam / user.py View on Github external
def _call_method(self, batch):
        response = api.interface("ISteamUser").GetPlayerSummaries(version=2, steamids=','.join(batch))

        return [profile.from_def(player) for player in response["response"]["players"]]
github Lagg / steamodd / steam / apps.py View on Github external
def __init__(self, **kwargs):
        self._api = api.interface("ISteamApps").GetAppList(version=2,
                                                           **kwargs)
        self._cache = {}
github Lagg / steamodd / steam / user.py View on Github external
def _call_method(self, batch):
        response = api.interface("ISteamUser").GetPlayerBans(steamids=','.join(batch))

        return [bans.from_def(player) for player in response["players"]]
github Lagg / steamodd / steam / items.py View on Github external
self._language = loc.language(lang).code
        self._app = int(app)
        self._cache = {}

        # WORKAROUND: CS GO v1 returns 404
        if self._app == 730 and version == 1:
            version = 2

        # WORKAROUND: certain apps have moved to GetSchemaOverview/GetSchemaItems
        if self._app in [440]:
            self._api = api.interface("IEconItems_" + str(self._app)).GetSchemaOverview(language=self._language, version=version, **kwargs)
            items = []
            next_start = 0
            # HACK: build the entire item list immediately because Valve decided not to allow us to get the entire thing at once
            while next_start is not None:
                next_items = api.interface("IEconItems_" + str(self._app)).GetSchemaItems(language=self._language, version=version, aggressive=True, start=next_start, **kwargs)
                items.extend(next_items["result"]["items"])
                next_start = next_items["result"].get("next", None)
            self._items = items
        else:
            self._api = api.interface("IEconItems_" + str(self._app)).GetSchema(language=self._language, version=version, **kwargs)
            self._items = None
github FAForever / server / steam / user.py View on Github external
def __init__(self, vanity, **kwargs):
        """ Takes a vanity URL part and tries
        to resolve it. """
        vanity = os.path.basename(str(vanity).strip('/'))

        self._cache = None
        self._api = api.interface("ISteamUser").ResolveVanityURL(vanityurl = vanity, **kwargs)
github FAForever / server / steam / items.py View on Github external
def __init__(self, app, lang = None, **kwargs):
        """ schema will be used to initialize the schema if given,
        lang can be any ISO language code.
        lm will be used to generate an HTTP If-Modified-Since header. """

        self._language = loc.language(lang).code
        self._app = app
        self._cache = {}

        self._api = api.interface("IEconItems_" + str(self._app)).GetSchema(language = self._language, **kwargs)
github Lagg / steamodd / steam / items.py View on Github external
"""
        'app': Steam app to get the inventory for.
        'profile': A user ID or profile object.
        'schema': The schema to use for item lookup.
        """

        self._app = app
        self._schema = schema
        self._cache = {}

        try:
            sid = profile.id64
        except:
            sid = str(profile)

        self._api = api.interface("IEconItems_" + str(self._app)).GetPlayerItems(SteamID=sid, **kwargs)
github Lagg / steamodd / steam / user.py View on Github external
def __init__(self, sid, **kwargs):
        """ Fetch user ban information """
        try:
            sid = sid.id64
        except AttributeError:
            sid = os.path.basename(str(sid).strip('/'))

        self._cache = {}
        self._api = api.interface("ISteamUser").GetPlayerBans(steamids=sid, **kwargs)