Low level methods¶
You can call any method from any of Steam API interfaces usingsteam.api.interface
class. Let’s start with a quick example where wefetch user’s game library.
- Pip install py-steamcmd-wrapper In order to install steam using this wrapper you'll have to do the following: from pysteamcmdwrapper import SteamCMD steam = SteamCMD ('MyInstallationDir') steam. Curently there are 4 methods available in the wrapper. These are as follows: install; login; appupdate; workshopupdate.
- The Steam application or Steam game has been mistakenly identified as a virus or 'trojan' by certain software as a result of the development of potentially-malicious programs which use the same filenames as valid Steam files (this is a very common practice amongst malicious software writers - many viruses already masquerade as valid operating system files).
Start by importing interface
class:
Call method GetOwnedGames
of interface IPlayerService
. We aregoing to fetch games of user with id 76561198017493014
and include allapplication information:
Since all method calls are lazy by default, this doesn’t do anything at all.We’ll need to either iterate over games
, print
it or access anyof its dictionary keys:
VALVE Steam® API Wrapper. Full SteamAPI + helpers is available. Steamworks SDK v1.31 (newer may be in the future) Supported languages: C/C, Delphi/Lazarus. (thanks to @RCrandall44 for donation) Porting DLL to VS2017 - x86 and x64; Porting Delphi code to x64; (Andy gift) Fixed callbacks; OnCreateItemResult.
Don’t worry, resource isn’t fetched each time you access results.
You can disable laziness of interface
by passing aggressive=True
to its method:
You can also pass since
(which translates to HTTP header If-Modified-Since
)and timeout
to method. By default, version
is set to 1
.data
can be passed to send POST data with requests. By default no data is assumed and request typesare GET. Any number of additional keyword arguments are supported depending on the given method (see documentation).
High level methods¶
Following classes are convenience wrappers around Low level methods. kwargs
are always passed to appropriate interface methods, so you can use all argumentsfrom previous section.
Apps¶
steam.apps.
app_list
(**kwargs)¶Retrieves a list of all Steam apps with their ID and localized name.
Items¶
steam.items.
schema
(app, lang=None, version=1, **kwargs)¶Wrapper for item schema of certain games from Valve. Those are currentlyavailable (along with their ids):
260
- Counter Strike: Source Beta440
- Team Fortress 2520
- Team Fortress 2 Public Beta570
- Dota 2620
- Portal 2710
- Counter-Strike: Global Offensive Beta Dev816
- Dota 2 internal test841
- Portal 2 Beta205790
- Dota 2 (beta) test
Fetching schema of Team Fortress 2 (id 440
) would look like:
Schema class is an iterator of steam.items.item()
objects. There arealso other properties available:
client_url
¶Client schema URL
language
¶The ISO code of the language the instanceis localized to
attributes
¶Returns all attributes in the schema
origins
¶Returns a map of all origins
qualities
¶Returns a dict of all possible qualities. The key(s) will be the ID,values are a tuple containing ID, name, localized name. To resolvea quality to a name intelligently use ‘_quality_definition’
particle_systems
¶Returns a dictionary of particle system dicts keyed by ID
kill_ranks
¶Returns a list of ranks for weapons with kill tracking
kill_types
¶Returns a dict with keys that are the value ofthe kill eater type attribute and values that are the namestring
steam.items.
item
(item, schema=None)¶Stores a single inventory item.
This is a simple wrapper around JSON representation of both schema andinventory items. It is composed mostly from item properties:
As convenience, item
acts also as iterator of its attributes:
Following properties are available:
attributes
¶Returns a list of attributes
quality
¶Returns a tuple containing ID, name, and localized name of the quality
inventory_token
¶Returns the item’s inventory token (a bitfield),deprecated.
position
¶Returns a position in the inventory or -1 if there’s no positionavailable (i.e. an item hasn’t dropped yet or got displaced)
equipped
¶Returns a dict of classes that have the item equipped and in what slot
equipable_classes
¶Returns a list of classes that _can_ use the item.
schema_id
¶Returns the item’s ID in the schema.
name
¶Returns the item’s undecorated name
type
¶Returns the item’s type. e.g. “Kukri” for the Tribalman’s Shiv.If Valve failed to provide a translation the type will be the token withoutthe hash prefix.
icon
¶URL to a small thumbnail sized image of the item, suitable for display in groups
image
¶URL to a full sized image of the item, for displaying ‘zoomed-in’ previews
id
¶Returns the item’s unique serial number if it has one
original_id
¶Returns the item’s original ID if it has one. This is the last “version”of the item before it was customized or otherwise changed
Download Steam Wrapper
level
¶Returns the item’s level (e.g. 10 for The Axtinguisher) if it has one
slot_name
¶Returns the item’s slot as a string, this includes “primary”,“secondary”, “melee”, and “head”. Note that this is the slotof the item as it appears in the schema, and not necessarilythe actual equipable slot. (see ‘equipped’)
cvar_class
¶Returns the item’s class(what you use in the game to equip it, not the craft class)
craft_class
¶Returns the item’s class in the crafting system if it has one.This includes hat, craft_bar, or craft_token.
craft_material_type
¶
custom_name
¶Returns the item’s custom name if it has one.
custom_description
¶Returns the item’s custom description if it has one.
quantity
¶Returns the number of uses the item has,for example, a dueling mini-game has 5 uses by default
description
¶Returns the item’s default description if it has one
min_level
¶Returns the item’s minimum level(non-random levels will have the same min and max level)
contents
¶Returns the item in the container, if there is one.This will be a standard item object.
tradable
¶Somewhat of a WORKAROUND since this flag is theresometimes, “cannot trade” is there sometimesand then there’s “always tradable”. Opposed toonly occasionally tradable when it feels like it.Attr 153 = cannot trade
craftable
¶Returns not craftable if the cannot craft flag exists. True, otherwise.
full_name
¶The full name of the item, generated dependingon things such as its quality, rank, the schema language,and so on.
kill_eaters
¶Returns a list of tuples containing the proper localized kill eater type strings and their valuesaccording to set/type/value “order”
rank
¶Returns the item’s rank (if it has one)as a dict that includes required score, name, and level.
available_styles
¶Returns a list of all styles defined for the item
style
¶The current style the item is set to or None if the item has no styles
capabilities
¶Returns a list of capabilities, these are flags for what the item can do or be done with
tool_metadata
¶A dict containing item dependant metadata such as holiday restrictions, types, and properties used by the client. Do not assume a stable syntax.
origin
¶Returns the item’s localized origin name
steam.items.
item_attribute
(attribute)¶Wrapper around item attributes.
Following properties are available:
formatted_value
¶Returns a formatted value as a string
formatted_description
¶Returns a formatted description string (%s* tokens replaced) or None if unavailable
name
¶The attribute’s name
cvar_class
¶The attribute class, mostly non-useful except for console usage in some cases
id
¶The attribute ID, used for indexing the description blocks in the schema
type
¶Returns the attribute effect type (positive, negative, or neutral). This is not the same as the value type, see ‘value_type’
value
¶Tries to intelligently return the raw value based on schema data.See also: ‘value_int’ and ‘value_float’
value_int
¶
value_float
¶
description
¶Returns the attribute’s description string, ifit is intended to be printed with the value there willbe a “%s1” token somewhere in the string. Use‘formatted_description’ to build one automatically.
value_type
¶The attribute’s type, note that this is the type of the attribute’svalue and not its affect on the item (i.e. negative or positive). See‘type’ for that.
hidden
¶True if the attribute is “hidden”(not intended to be shown to the end user). Notethat hidden attributes also usually have no description string
account_info
¶Certain attributes have a user’s account informationassociated with it such as a gifted or crafted item.
A dict with two keys: ‘persona’ and ‘id64’.None if the attribute has no account information attached to it.
steam.items.
inventory
(app, profile, schema=None, **kwargs)¶Wrapper around player inventory.
Fetches inventory of player
for given app
id:
Since inventory endpoint returns just very basic structure, we have toprovide also schema
if we want to work with fully populated steam.items.item()
objects:
There is also single property:
cells_total
¶The total number of cells in the inventory.This can be used to determine if the user has bought anexpander. This is NOT the number of items in the inventory, buthow many items CAN be stored in it. The actual current inventory sizecan be obtained by calling len on an inventory object
steam.items.
assets
(app, lang=None, **kwargs)¶Steam Wrapper Mac 2020
Class for building asset catalogs
Fetches store assets for app
id. Assets class acts as an iterator ofsteam.items.asset_item()
objects.
If you care only about single currency, currency
keyword argument inISO 4217 format is also accepted.
All available tags of assets are available in following property:
tags
¶Returns a dict that is a map of the internal tag namesfor this catalog to the localized labels.
steam.items.
asset_item
(asset, catalog)¶Stores a single item from a steam asset catalog
tags
¶Returns a dict containing tags and their localized labels as values
base_price
¶The price the item normally goes for, not including discounts.
price
¶Returns the most current price available, which may include sales/discounts
name
¶The asset “name” which is in fact a schema id of item.
Localization¶
steam.loc.
language
(code=None)¶Steam API localization tools and reference
If language is not specified, it defaults to English:
If language isn’t supported, __init__
raises steam.loc.LanguageUnsupportedError()
Steam Wrapper Mac Download
Properties:
code
¶
name
¶
- class
steam.loc.
LanguageUnsupportedError
¶
Remote storage¶
Tools for probing Steam’s UGC file storage system. UGC itself means UserGenerated Content but in this context assume that such terms as “UGC ID” arespecific to Valve’s system. UGC IDs are found in various places in the API andSteam including decal attributes on TF2 items.
Practically speaking the purpose of ugc_file is similar to that ofsteam.user.vanity_url
. Namely to convert an arbitrary ID intosomething useful like a direct URL.
steam.remote_storage.
ugc_file
(appid, ugcid64, **kwargs)¶Resolves a UGC file ID into usable metadata.
Fetches UGC file metadata for the given UGC and app ID.
Properties:
size
¶Size in bytes
filename
¶Local filename is what the user named it, not the URL
url
¶UGC link
- class
steam.remote_storage.
FileNotFoundError
¶
User¶
steam.user.
vanity_url
(vanity, **kwargs)¶Class for holding a vanity URL and its id64
steam.user.
profile
(sid, **kwargs)¶Functions for reading user account data
id64
¶Returns the 64 bit steam ID (use with other API requests)
id32
¶Returns the 32 bit steam ID
persona
¶Returns the user’s persona (what you usually see in-game)
profile_url
¶Returns a URL to the user’s Community profile page
vanity
¶Returns the user’s vanity url if it exists, None otherwise
avatar_small
¶
avatar_medium
¶
avatar_large
¶
status
¶Returns the user’s status.0: offline1: online2: busy3: away4: snooze5: looking to trade6: looking to playIf player’s profile is private, this will always be 0.
visibility
¶Returns the visibility setting of the profile.1: private2: friends only3: public
configured
¶Returns true if the user has created a Community profile
last_online
¶Returns the last time the user was online as a localtimetime.struct_time struct
comments_enabled
¶Returns true if the profile allows public comments
real_name
¶Returns the user’s real name if it’s set and public
primary_group
¶Returns the user’s primary group ID if set.
creation_date
¶Returns the account creation date as a localtime time.struct_timestruct if public
current_game
¶Returns a tuple of 3 elements (each of which may be None if not available):Current game app ID, server ip:port, misc. extra info (eg. game title)
location
¶Returns a tuple of 2 elements (each of which may be None if not available):State ISO code, country ISO code
lobbysteamid
¶Returns a lobbynumber as int from few Source games or 0 if not in lobby.
level
¶Returns the the user’s profile level, note that this runs a separaterequest because the profile level data isn’t in the standard player summaryoutput even though it should be. Which is also why it’s not implementedas a separate class. You won’t need this output and not the profile output
from_def
(obj)¶Builds a profile object from a raw player summary object
current_game
Returns a tuple of 3 elements (each of which may be None if not available):Current game app ID, server ip:port, misc. extra info (eg. game title)
- class
steam.user.
profile_batch
(sids)¶
steam.user.
bans
(sid, **kwargs)¶id64
¶
community
¶Community banned
vac
¶User is currently VAC banned
vac_count
¶Number of VAC bans on record
days_unbanned
¶Number of days since the last ban.Note that users without a ban on record will havethis set to 0 so make sure to test bans.vac
economy
¶Economy ban status which is a string for whatever reason
game_count
¶Number of bans in games, this includes CS:GO Overwatch bans
- classmethod
from_def
(obj)¶
- class
steam.user.
bans_batch
(sids)¶
steam.user.
friend
(friend_dict)¶Class used to store friend obtained from GetFriendList.
steamid
¶Returns the 64 bit Steam ID
relationship
¶Returns relationship qualifier
since
¶Returns date when relationship was created as a localtime time.struct_time
steam.user.
friend_list
(sid, relationship='all', **kwargs)¶Creates an iterator of friend objects fetched from given user’s Steam ID.Allows for filtering by specyfing relationship argument in constructor,but API seems to always return items with friend relationship.Possible filter values: all, friend.
count
¶Returns number of friends