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(app, profile, schema=None, section=None, timeout=None, lang=None)

Takes steam.sim.inventory_context and user id, and fetches data from given inventory:

>>> inventory = steam.sim.inventory(inventory_context.get(570), '76561198017493014')
>>> 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'
...

Properties:

cells_total

Returns the total amount of “cells” which in this case is just an amount of items

class steam.sim.item(theitem, context)

Subclass of steam.items.item. It is used as output from steam.sim.inventory.

On top of properties inherited from steam.items.item, these are available:

attributes

Returns a list of attributes

category

Returns the category name that the item is a member of

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 from steam.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