Steam Inventory Manager¶
High level item manager which scrapes data from http://steamcommunity.com instead of Steam API.
- class steam.sim.inventory_context(user, **kwargs)¶
Builds context data that is fetched from a user’s inventory page
Fetches metadata of inventories for different games of given user:
>>> inventory_context = steam.sim.inventory_context('76561198017493014') >>> inventory_context.apps [u'570', u'753', u'251970', u'440', u'620'] >>> inventory_context.get(570) {u'name': u'Dota 2', u'trade_permissions': u'FULL', u'rgContexts': ...}
This class also acts as an iterator of inventories:
>>> for game_inventory_ctx in inventory_context: ... game_inventory_ctx['name'] ... u'Team Fortress 2' u'Dota 2' u'Portal 2' u'Steam' u'Sins of a Dark Age'
Properties:
- ctx¶
- apps¶
Returns a list of valid app IDs
- get(key)¶
Returns context data for a given app, can be an ID or a case insensitive name
- class steam.sim.inventory(profile, app, section, page_start=None, page_size=2000, timeout=None, lang=None)¶
Takes a user ID, app ID and inventory section ID. Returns given inventory using the JSON/AJAX feed:
>>> inventory = steam.sim.inventory('76561198017493014', 570, 2) >>> inventory.cells_total 650
This class also acts as an iterator yielding
steam.sim.item
objects:>>> for item in inventory: ... item.full_name ... u'Rattlebite' u'Heavenly Guardian Skirt' u'Gloried Horn of Druud' ...
An optional last_assetid and page size can be passed for pagination.
Properties:
- cells_total¶
Returns the total amount of “cells” which in this case is just an amount of items
- page_end¶
Returns the last asset ID of this page if the inventory continues. Can be passed as page_start arg
- pages_continue¶
Returns True if pages continue beyond the one loaded in this instance, False otherwise
- class steam.sim.item(theitem)¶
Subclass of
steam.items.item
. It is used as output fromsteam.sim.inventory
.On top of properties inherited from
steam.items.item
, these are available:- attributes¶
Returns a list of attributes
- background_color¶
Returns the color associated with the item as a hex RGB tuple
- name¶
- custom_name¶
- name_color¶
Returns the name color as an RGB tuple
- full_name¶
- hash_name¶
The URL-friendly identifier for the item. Generates its own approximation if one isn’t available
- tool_metadata¶
- tags¶
A list of tags attached to the item if applicable, format is subject to change
- tradable¶
- craftable¶
- quality¶
Can’t really trust presence of a schema here, but there is an ID sometimes
- quantity¶
- attributes¶
- position¶
- schema_id¶
This will return none if there is no schema ID, since it’s a valve specific concept for the most part
- type¶
- icon¶
- image¶
- id¶
- slot_name¶
- appid¶
Return the app ID that this item belongs to
- class steam.sim.item_attribute(attribute)¶
Subclass of
steam.items.item_attribute
. It is used as output fromsteam.sim.item.attributes()
.On top of properties inherited from
steam.items.item_attribute()
, these are available:- value_type¶
- description¶
- description_color¶
Returns description color as an RGB tuple
- type¶
- value¶