API reference¶
The following document outlines the front facing aspects of steam.py.
Note
This module uses Python’s logging module to debug, give information and diagnose errors, it is recommended to configure this if necessary as errors or warnings will not be propagated properly.
Client¶
- asyncchange_presence
- defclear
- asyncclose
- asynccode
- asyncconnect
- @event
- asyncfetch_clan
- asyncfetch_clan_named
- asyncfetch_game
- asyncfetch_package
- asyncfetch_price
- asyncfetch_product_info
- asyncfetch_published_file
- asyncfetch_published_files
- asyncfetch_server
- asyncfetch_servers
- asyncfetch_trade
- asyncfetch_user
- asyncfetch_user_named
- asyncfetch_users
- defget_clan
- defget_game
- defget_group
- defget_package
- defget_trade
- defget_user
- defis_closed
- defis_ready
- asynclogin
- asyncon_announcement_create
- asyncon_clan_invite
- asyncon_clan_invite_accept
- asyncon_clan_invite_decline
- asyncon_clan_join
- asyncon_clan_leave
- asyncon_clan_update
- asyncon_comment
- asyncon_connect
- asyncon_disconnect
- asyncon_error
- asyncon_event_create
- asyncon_friend_add
- asyncon_friend_remove
- asyncon_group_join
- asyncon_group_leave
- asyncon_group_update
- asyncon_login
- asyncon_message
- asyncon_reaction_add
- asyncon_reaction_remove
- asyncon_ready
- asyncon_socket_receive
- asyncon_socket_send
- asyncon_trade_accept
- asyncon_trade_cancel
- asyncon_trade_counter
- asyncon_trade_decline
- asyncon_trade_expire
- asyncon_trade_receive
- asyncon_trade_send
- asyncon_typing
- asyncon_user_invite
- asyncon_user_invite_accept
- asyncon_user_invite_decline
- asyncon_user_update
- defrun
- asyncstart
- async fortrade_history
- asynctrade_url
- asyncwait_for
- asyncwait_until_ready
- class steam.Client(*, proxy: str | None = ..., proxy_auth: aiohttp.helpers.BasicAuth | None = ..., connector: aiohttp.connector.BaseConnector | None = ..., max_messages: int | None = 1000, game: steam.game.Game | None = ..., games: list[steam.game.Game] = ..., state: steam.enums.PersonaState | None = PersonaState.Online, ui_mode: steam.enums.UIMode | None = UIMode.Desktop, flags: steam.enums.PersonaStateFlag | None = PersonaStateFlag.NONE, force_kick: bool = False, language: Language = Language.English, auto_chunk_chat_groups: bool = False)¶
Represents a client connection that connects to Steam. This class is used to interact with the Steam API and CMs.
- Parameters:
proxy – A proxy URL to use for requests.
proxy_auth – The proxy authentication to use with requests.
connector – The connector to use with the
aiohttp.ClientSession.max_messages – The maximum number of messages to store in the internal cache, default is 1000.
game – A games to set your status as on connect.
games – A list of games to set your status to on connect.
state –
The state to show your account as on connect.
Note
Setting your status to
Offline, will stop you receiving persona state updates and by extensionon_user_update()will stop being dispatched.ui_mode – The UI mode to set your status to on connect.
flags – Flags to set your persona state to.
force_kick – Whether to forcefully kick any other playing sessions on connect. Defaults to
False.language – The language to use when interacting with the API.
auto_chunk_chat_groups – Whether to automatically call chunk on clans and groups filling
ChatGroup.members. Setting this toTrueisn’t recommend unless you have a good internet connection and good hardware.
- property user: ClientUser¶
Represents the connected client.
Noneif not logged in.
- property trades: Sequence[TradeOffer]¶
A read-only list of all the trades the connected client can see.
- property emoticons: Sequence[ClientEmoticon]¶
A read-only list of all the emoticons the client has.
- property stickers: Sequence[ClientSticker]¶
A read-only list of all the stickers the client has.
- property latency: float¶
Measures latency between a heartbeat send and the heartbeat interval in seconds.
- await code()¶
Get the current steam guard code.
Warning
This function will wait for a Steam guard code using
input()in an executor if no shared_secret is passed torun()orstart(), which blocks exiting until one is entered.- Return type:
- @event(coro: None = None) Callable[[E], E]¶
- @event(coro: E) E
A decorator that could be called. Register an event to listen to.
The events must be a coroutine, if not,
TypeErroris raised.Usage:
@client.event async def on_ready(): print("Ready!")
- Raises:
TypeError – The function passed is not a coroutine.
- Return type:
Union[collections.abc.Callable[steam.client.E,steam.client.E],steam.client.E]
- run(username: str, password: str, *, shared_secret: str | None = None, identity_secret: str | None = None) object¶
A blocking call that abstracts away the event loop initialisation from you.
It is not recommended to subclass this method, it is normally favourable to subclass
start()as it is a coroutine.Note
This takes the same arguments as
start().- Return type:
builtins.object
- await login(username, password, *, shared_secret=None)¶
Login a Steam account and the Steam API with the specified credentials.
- Parameters:
username (str) – The username of the user’s account.
password (str) – The password of the user’s account.
shared_secret (Optional[str]) – The shared_secret of the desired Steam account, used to generate the 2FA code for login. If
Noneis passed, the code will need to be inputted by the user viacode().
- Raises:
.InvalidCredentials – Invalid credentials were passed.
.LoginError – An unknown login related error occurred.
.NoCMsFound – No community managers could be found to connect to.
- await close()¶
Close the connection to Steam.
- clear()¶
Clears the internal state of the bot. After this, the bot can be considered “re-opened”, i.e.
is_closed()andis_ready()both returnFalse. This also clears the internal cache.
- await start(username, password, *, shared_secret=None, identity_secret=None)¶
A shorthand coroutine for
login()andconnect().If no
shared_secretis passed, you will have to manually enter a Steam guard code usingcode().
- await connect()¶
Initialize a connection to a Steam CM after logging in.
- get_user(id)¶
Returns a user from cache with a matching ID or
Noneif the user was not found.- Parameters:
id (utils.Intable) – The ID of the user, can be an
SteamID.id64,SteamID.id,SteamID.id2or anSteamID.id3.- Return type:
- await fetch_user(id)¶
Fetches a user with a matching ID or
Noneif the user was not found.- Parameters:
id (utils.Intable) – The ID of the user, can be an
SteamID.id64,SteamID.id,SteamID.id2or anSteamID.id3.- Return type:
- await fetch_users(*ids)¶
Fetches a list of
UserorNoneif the user was not found, from their IDs.Note
The
Userobjects returned are unlikely to retain the order they were originally in.- Parameters:
ids (utils.Intable) – The user’s IDs.
- Return type:
- await fetch_user_named(name)¶
Fetches a user from https://steamcommunity.com from their community URL name.
- Parameters:
name (str) – The name of the user after https://steamcommunity.com/id
- Return type:
- get_trade(id)¶
Get a trade from cache with a matching ID or
Noneif the trade was not found.- Parameters:
id (int) – The id of the trade to search for from the cache.
- Return type:
- await fetch_trade(id, *, language=None)¶
Fetches a trade with a matching ID or
Noneif the trade was not found.- Parameters:
- Return type:
- get_group(id)¶
Get a group from cache with a matching ID or
Noneif the group was not found.- Parameters:
id (utils.Intable) – The ID of the group, can be an
SteamID.id64,SteamID.id,SteamID.id2or anSteamID.id3.- Return type:
- get_clan(id)¶
Get a clan from cache with a matching ID or
Noneif the group was not found.- Parameters:
id (utils.Intable) – The ID of the clan, can be an
SteamID.id64,SteamID.id,SteamID.id2or anSteamID.id3.- Return type:
- await fetch_clan(id)¶
Fetches a clan from the websocket with a matching ID or
Noneif the clan was not found.- Parameters:
id (utils.Intable) – The ID of the clan, can be an
SteamID.id64,SteamID.id,SteamID.id2or anSteamID.id3.- Return type:
- await fetch_clan_named(name)¶
Fetches a clan from https://steamcommunity.com with a matching name or
Noneif the clan was not found.- Parameters:
name (str) – The name of the Steam clan.
- Return type:
- get_game(id)¶
Creates a stateful game from its ID.
- await fetch_game(id, *, language=None)¶
Fetch a game from its ID or
Noneif the game was not found.
- get_package(id)¶
Creates a package from its ID.
- Parameters:
id (int) – The ID of the package.
- Return type:
- await fetch_package(id, *, language=None)¶
Fetch a package from its ID.
- Parameters:
- Return type:
- await fetch_server(*, id: utils.Intable) steam.game_server.GameServer | None¶
- await fetch_server(*, ip: str, port: int | None = None) steam.game_server.GameServer | None
Fetch a
GameServerfrom its ip and port or its SteamID orNoneif fetching the server failed.- Parameters:
ip – The ip of the server.
port – The port of the server.
id – The ID of the game server, can be an
SteamID.id64,SteamID.id2or anSteamID.id3. If this is passed, it makes a call to the master server to fetch its ip and port.
Note
Passing an
ip,portandidto this function will raise anTypeError.- Return type:
- await fetch_servers(query, *, limit=100)¶
Query game servers.
- Parameters:
- Return type:
- await fetch_product_info(*, games: Collection[Game]) list[steam.manifest.GameInfo]¶
- await fetch_product_info(*, packages: Collection[Package]) list[steam.manifest.PackageInfo]
- await fetch_product_info(*, games: Collection[Game], packages: Collection[Package]) tuple[list[steam.manifest.GameInfo], list[steam.manifest.PackageInfo]]
Fetch product info.
- Parameters:
games – The games to fetch info on.
packages – The packages to fetch info on.
- Return type:
Union[list[steam.manifest.GameInfo],list[steam.manifest.PackageInfo],tuple[list[steam.manifest.GameInfo],list[steam.manifest.PackageInfo]]]
- await fetch_published_file(id, *, revision=PublishedFileRevision.Default, language=None)¶
Fetch a published file from its ID.
- Parameters:
id (int) – The ID of the published file.
revision (PublishedFileRevision) – The revision of the published file to fetch.
language (Optional[Language]) – The language to fetch the published file in. If
None, the current language is used.
- Return type:
- await fetch_published_files(*ids, revision=PublishedFileRevision.Default, language=None)¶
Fetch published files from their IDs.
- Parameters:
ids (int) – The IDs of the published files.
revision (PublishedFileRevision) – The revision of the published files to fetch.
language (Optional[Language]) – The language to fetch the published files in. If
None, the current language is used.
- Return type:
- async for ... in trade_history(*, limit=100, before=None, after=None, language=None)¶
An
AsyncIteratorfor accessing asteam.ClientUser’ssteam.TradeOfferobjects.Examples
Usage:
async for trade in client.trade_history(limit=10): items = [getattr(item, "name", str(item.asset_id)) for item in trade.items_to_receive] items = ", ".join(items) or "Nothing" print("Partner:", trade.partner) print("Sent:", items)
Flattening into a list:
trades = await client.trade_history(limit=50).flatten() # trades is now a list of TradeOffer
All parameters are optional.
- Parameters:
limit (int | None) – The maximum number of trades to search through. Default is
100. Setting this toNonewill fetch all of the user’s trades, but this will be a very slow operation.before (Optional[datetime]) – A time to search for trades before.
after (Optional[datetime]) – A time to search for trades after.
language (Optional[Language]) – The language to fetch the trade in.
Noneuses the current language.
- Yields:
- await change_presence(*, game=None, games=None, state=None, ui_mode=None, flags=None, force_kick=False)¶
Set your status.
- Parameters:
game (Optional[Game]) – A games to set your status as.
games (Optional[list[steam.game.Game]]) – A list of games to set your status to.
state (Optional[PersonaState]) –
The state to show your account as.
Warning
Setting your status to
Offline, will stop you receiving persona state updates and by extensionon_user_update()will stop being dispatched.ui_mode (Optional[UIMode]) – The UI mode to set your status to.
flags (Optional[PersonaStateFlag]) – The flags to update your account with.
force_kick (bool) – Whether to forcefully kick any other playing sessions.
- await trade_url(generate_new=False)¶
Fetches this account’s trade url.
- await wait_until_ready()¶
Waits until the client’s internal cache is all ready.
- await fetch_price(name, game, currency=None)¶
Fetch the
PriceOverviewfor an item.- Parameters:
- Return type:
- await on_reaction_add(reaction)¶
Called when a reaction is added to a message.
- Parameters:
reaction (MessageReaction) – The reaction that was added.
- await on_reaction_remove(reaction)¶
Called when a reaction is removed from a message.
- Parameters:
reaction (MessageReaction) – The reaction that was removed.
- await wait_for(event: ~typing.Literal['connect', 'disconnect', 'ready', 'login', 'logout'], *, check: ~collections.abc.Callable[[], bool] = <return_true>, timeout: float | None = None) None¶
- await wait_for(event: ~typing.Literal['error'], *, check: ~collections.abc.Callable[[str, Exception, tuple[typing.Any, ...], dict[str, typing.Any]], bool] = <return_true>, timeout: float | None = None) tuple[str, Exception, tuple[Any, ...], dict[str, Any]]
- await wait_for(event: ~typing.Literal['message'], *, check: Callable[[Message], bool] = <return_true>, timeout: float | None = None) Message
- await wait_for(event: ~typing.Literal['comment'], *, check: Callable[[Comment], bool] = <return_true>, timeout: float | None = None) Comment
- await wait_for(event: ~typing.Literal['user_update'], *, check: Callable[[User, User], bool] = <return_true>, timeout: float | None = None) tuple[User, User]
- await wait_for(event: ~typing.Literal['clan_update'], *, check: Callable[[Clan, Clan], bool] = <return_true>, timeout: float | None = None) tuple[Clan, Clan]
- await wait_for(event: ~typing.Literal['group_update'], *, check: Callable[[Group, Group], bool] = <return_true>, timeout: float | None = None) tuple[Group, Group]
- await wait_for(event: ~typing.Literal['typing'], *, check: Callable[[User, datetime.datetime], bool] = <return_true>, timeout: float | None = None) tuple[User, datetime.datetime]
- await wait_for(event: ~typing.Literal['trade_receive', 'trade_send', 'trade_accept', 'trade_decline', 'trade_cancel', 'trade_expire', 'trade_counter'], *, check: Callable[[TradeOffer], bool] = <return_true>, timeout: float | None = None) TradeOffer
- await wait_for(event: ~typing.Literal['user_invite', 'user_invite_accept', 'user_invite_decline'], *, check: Callable[[UserInvite], bool] = <return_true>, timeout: float | None = None) UserInvite
- await wait_for(event: ~typing.Literal['friend_add', 'friend_remove'], *, check: Callable[[Friend], bool] = <return_true>, timeout: float | None = None) User
- await wait_for(event: ~typing.Literal['clan_invite', 'clan_invite_accept', 'clan_invite_decline'], *, check: Callable[[ClanInvite], bool] = <return_true>, timeout: float | None = None) ClanInvite
- await wait_for(event: ~typing.Literal['clan_join', 'clan_leave'], *, check: Callable[[Clan], bool] = <return_true>, timeout: float | None = None) Clan
- await wait_for(event: ~typing.Literal['group_join', 'group_leave'], *, check: Callable[[Group], bool] = <return_true>, timeout: float | None = None) Group
- await wait_for(event: ~typing.Literal['event_create'], *, check: Callable[[Event], bool] = <return_true>, timeout: float | None = None) Event
- await wait_for(event: ~typing.Literal['announcement_create'], *, check: Callable[[Announcement], bool] = <return_true>, timeout: float | None = None) Announcement
- await wait_for(event: ~typing.Literal['socket_receive', 'socket_send'], *, check: ~collections.abc.Callable[[ProtoMsgs | GCMsgs], bool] = <return_true>, timeout: float | None = None) Msgs
Wait for the first event to be dispatched that meets the requirements, this by default is the first event with a matching event name.
- Parameters:
event – The event name from the event reference, but without the
on_prefix, to wait for.check – A callable predicate that checks the received event. The arguments must match the parameters of the
eventbeing waited for and must return abool.timeout – By default,
wait_for()function does not timeout, however, in the case atimeoutparameter is passed after the amount of seconds passesasyncio.TimeoutErroris raised.
- Raises:
asyncio.TimeoutError – If the provided timeout was reached.
- Returns:
Returns
None, a single argument or atupleof multiple arguments that mirrors the parameters for theeventparameter from the event reference.- Return type:
Event Reference¶
This page outlines the different types of events listened for by the Client.
There are two ways to register an event, the first way is through the use of Client.event(). The second way is
through subclassing Client and overriding the specific events. For example:
import steam
class MyClient(steam.Client):
async def on_trade_receive(self, trade: steam.TradeOffer) -> None:
await trade.partner.send('Thank you for your trade')
print(f'Received trade: #{trade.id}')
print('Trade partner is:', trade.partner)
print('We would send:', len(trade.items_to_send), 'items')
print('We would receive:', len(trade.items_to_receive), 'items')
if trade.is_gift():
print('Accepting the trade as it is a gift')
await trade.accept()
If an event handler raises an exception, Client.on_error() will be called to handle it, which by default prints a
traceback and ignoring the exception.
Warning
All the events must be a coroutine function. If they aren’t, a TypeError will be raised.
- await Client.on_connect()¶
Called when the client has successfully connected to Steam. This is not the same as the client being fully prepared, see
on_ready()for that.The warnings on
on_ready()also apply.
- await Client.on_disconnect()¶
Called when the client has disconnected from Steam. This could happen either through the internet disconnecting, an explicit call to logout, or Steam terminating the connection.
This function can be called multiple times.
- await Client.on_ready()¶
Called after a successful login and the client has handled setting up everything.
Warning
This function is not guaranteed to be the first event called. Likewise, this function is not guaranteed to only be called once. This library implements reconnection logic and will therefore end up calling this event whenever a CM disconnects.
- await Client.on_login()¶
Called when the client has logged into https://steamcommunity.com.
- await Client.on_error(event, error, *args, **kwargs)¶
The default error handler provided by the client.
Usually when an event raises an uncaught exception, a traceback is printed to
sys.stderrand the exception is ignored. If you want to change this behaviour and handle the exception yourself, this event can be overridden. Which, when done, will suppress the default action of printing the traceback.If you want exception to propagate out of the
Clientclass you can define anon_errorhandler consisting of a single empty The raise statement. Exceptions raised byon_errorwill not be handled in any way byClient.
- await Client.on_message(message)¶
Called when a message is created.
- Parameters:
message (steam.Message) – The message that was received.
- await Client.on_typing(user, when)¶
Called when typing is started.
- Parameters:
user (steam.User) – The user that started typing.
when (datetime.datetime) – The time the user started typing at.
- await Client.on_trade_receive(trade)¶
Called when the client receives a trade offer.
- Parameters:
trade (steam.TradeOffer) – The trade offer that was received.
- await Client.on_trade_send(trade)¶
Called when the client sends a trade offer.
- Parameters:
trade (steam.TradeOffer) – The trade offer that was sent.
- await Client.on_trade_accept(trade)¶
Called when the client or the trade partner accepts a trade offer.
- Parameters:
trade (steam.TradeOffer) – The trade offer that was accepted.
- await Client.on_trade_decline(trade)¶
Called when the client or the trade partner declines a trade offer.
- Parameters:
trade (steam.TradeOffer) – The trade offer that was declined.
- await Client.on_trade_cancel(trade)¶
Called when the client or the trade partner cancels a trade offer.
Note
This is called when the trade state becomes
CanceledandCanceledBySecondaryFactor.- Parameters:
trade (steam.TradeOffer) – The trade offer that was cancelled.
- await Client.on_trade_expire(trade)¶
Called when a trade offer expires due to being active for too long.
- Parameters:
trade (steam.TradeOffer) – The trade offer that expired.
- await Client.on_trade_counter(trade)¶
Called when the client or the trade partner counters a trade offer.
- Parameters:
trade (steam.TradeOffer) – The trade offer that was countered.
- await Client.on_comment(comment)¶
Called when the client receives a comment notification.
- Parameters:
comment (steam.Comment) – The comment received.
- await Client.on_user_invite(invite)¶
Called when the client receives/sends an invite from/to a
Userto become a friend.- Parameters:
invite (steam.UserInvite) – The invite received.
- await Client.on_user_invite_accept(invite)¶
Called when the client/invitee accepts an invite from/to a
Userto become a friend.- Parameters:
invite (steam.UserInvite) – The invite that was accepted.
- await Client.on_user_invite_decline(invite)¶
Called when the client/invitee declines an invite from/to a
Userto become a friend.- Parameters:
invite (steam.UserInvite) – The invite that was declined.
- await Client.on_friend_add(friend)¶
Called when a friend is added to the client’s friends list.
- Parameters:
friend (steam.Friend) – The friend that was added.
- await Client.on_user_update(before, after)¶
Called when a user is updated, due to one or more of the following attributes changing:
- Parameters:
before (steam.User) – The user’s state before it was updated.
after (steam.User) – The user’s state now.
- await Client.on_friend_remove(friend)¶
Called when you or the
friendremove each other from your friends lists.- Parameters:
friend (steam.Friend) – The friend who was removed.
- await Client.on_clan_invite(invite)¶
Called when the client receives/sends an invite from/to a
Userto join aClan.- Parameters:
invite (steam.ClanInvite) – The invite received.
- await Client.on_clan_invite_accept(invite)¶
Called when the client/invitee accepts an invite to join a
Clan.- Parameters:
invite (steam.ClanInvite) – The invite that was accepted.
- await Client.on_clan_invite_decline(invite)¶
Called when the client/invitee declines an invite to join a
Clan.- Parameters:
invite (steam.ClanInvite) – The invite that was declined.
- await Client.on_clan_join(clan)¶
Called when the client joins a new clan.
- Parameters:
clan (steam.Clan) – The joined clan.
- await Client.on_clan_update(before, after)¶
Called when a clan is updated, due to one or more of the following attributes changing:
- Parameters:
before (steam.Clan) – The clan’s state before it was updated.
after (steam.Clan) – The clan’s state now.
- await Client.on_clan_leave(clan)¶
Called when the client leaves a clan.
- Parameters:
clan (steam.Clan) – The left clan.
- await Client.on_group_join(group)¶
Called when the client joins a new group.
- Parameters:
group (steam.Group) – The joined group.
- await Client.on_group_update(before, after)¶
Called when a group is updated.
- Parameters:
before (steam.Group) – The group’s state before it was updated.
after (steam.Group) – The group’s state now.
- await Client.on_group_leave(group)¶
Called when the client leaves a group.
- Parameters:
group (steam.Group) – The left group.
- await Client.on_event_create(event)¶
Called when an event in a clan is created.
- Parameters:
event (steam.Event) – The event that was created.
- await Client.on_announcement_create(announcement)¶
Called when an announcement in a clan is created.
- Parameters:
announcement (steam.Announcement) – The announcement that was created.
- await Client.on_socket_receive(msg)¶
Called when the connected CM parses a received
Msg/MsgProto- Parameters:
msg (Msg | MsgProto) – The received message.
- await Client.on_socket_send(msg)¶
Called when the client sends a
Msg/MsgPrototo the connected CM.- Parameters:
msg (Msg | MsgProto) – The sent message.
Utilities¶
steam.py provides some utility functions.
- steam.utils.make_id64(id=0, type=None, universe=None, instance=None)¶
Convert various representations of Steam IDs to its Steam 64-bit ID.
- Parameters:
id (Intable) – The ID to convert.
type (TypeType | None) – The type of the ID. Can be the name, the integer value of the type or the recommended way is to use
steam.Type.universe (UniverseType | None) – The universe of the ID. Can be the name, the integer value of the universe or the recommended way is to use
steam.Universe.instance (InstanceType | None) – The instance of the ID.
Examples
make_id64() # invalid make_id64(12345) make_id64("12345") # account ids make_id64(12345, type=steam.Type.Clan) # makes the clan id into a clan id64 make_id64(103582791429521412) make_id64("103582791429521412") # id64s make_id64("STEAM_1:0:2") # id2 make_id64("[g:1:4]") # id3
- Raises:
.InvalidSteamID – The created 64-bit Steam ID would be invalid.
- Returns:
The 64 bit Steam ID.
- Return type:
- steam.utils.parse_trade_url(url)¶
Parses a trade URL for useful information.
- Parameters:
url (StrOrURL) – The trade URL to search.
- Returns:
A
re.Matchobject withtokenanduser_idre.Match.group()objects orNone.- Return type:
Then some functions from discord.py
- steam.utils.get(iterable, **attrs)¶
A helper that returns the first element in the iterable that meets all the traits passed in
attrs. This is an alternative forfind().Examples
bff = steam.utils.get(client.users, name="Gobot1234") trade = steam.utils.get(client.trades, state=TradeOfferState.Active, partner=message.author) # multiple attributes are also accepted
- steam.utils.find(predicate, iterable)¶
A helper to return the first element found in the sequence.
Examples
first_active_offer = steam.utils.find( lambda trade: trade.state == TradeOfferState.Active, client.trades, ) # how to get an object using a conditional
- Parameters:
- Returns:
The first element from the
iterablefor which thepredicatereturnsTrueor if no matching element was found returnsNone.- Return type:
Enumerations¶
- class steam.Result¶
An enumeration.
- Invalid = 0¶
Invalid Result.
- OK = 1¶
Success.
- Fail = 2¶
Generic failure.
- NoConnection = 3¶
Your Steam client doesn’t have a connection to the back-end.
- InvalidPassword = 5¶
Password/ticket is invalid.
- LoggedInElsewhere = 6¶
Same user logged in elsewhere.
- InvalidProtocolVersion = 7¶
Protocol version is incorrect.
- InvalidParameter = 8¶
A parameter is incorrect.
- FileNotFound = 9¶
File was not found.
- Busy = 10¶
Called method busy - action not taken.
- InvalidState = 11¶
Called object was in an invalid state.
- InvalidName = 12¶
The name was invalid.
- InvalidEmail = 13¶
The email was invalid.
- DuplicateName = 14¶
The name is not unique.
- AccessDenied = 15¶
Access is denied.
- Timeout = 16¶
Operation timed out.
- Banned = 17¶
VAC2 banned.
- AccountNotFound = 18¶
Account not found.
- InvalidSteamID = 19¶
The Steam ID was invalid.
The requested service is currently unavailable.
- NotLoggedOn = 21¶
The user is not logged on.
- Pending = 22¶
Request is pending (may be in process, or waiting on third party).
- EncryptionFailure = 23¶
Encryption or decryption failed.
- InsufficientPrivilege = 24¶
Insufficient privilege.
- LimitExceeded = 25¶
Too much of a good thing.
- Revoked = 26¶
Access has been revoked (used for revoked guest passes).
- Expired = 27¶
License/Guest pass the user is trying to access is expired.
- AlreadyRedeemed = 28¶
Guest pass has already been redeemed by account, cannot be acknowledged again.
- DuplicateRequest = 29¶
The request is a duplicate, ignored this time.
- AlreadyOwned = 30¶
All the games in guest pass redemption request are already owned by the user.
- IPNotFound = 31¶
IP address not found.
- PersistFailed = 32¶
Failed to write change to the data store.
- LockingFailed = 33¶
Failed to acquire access lock for this operation.
- LogonSessionReplaced = 34¶
The logon session has been replaced.
- ConnectFailed = 35¶
Failed to connect.
- HandshakeFailed = 36¶
The authentication handshake has failed.
- IOFailure = 37¶
Generic IO failure.
- RemoteDisconnect = 38¶
The remote server has disconnected.
- ShoppingCartNotFound = 39¶
Failed to find the shopping cart requested.
- Blocked = 40¶
A user blocked the action.
- Ignored = 41¶
The target is ignoring sender.
- NoMatch = 42¶
Nothing matching the request found.
- AccountDisabled = 43¶
The account is disabled.
- ServiceReadOnly = 44¶
This service is not accepting content changes right now.
- AccountNotFeatured = 45¶
Account doesn’t have value, so this feature isn’t available.
- AdministratorOK = 46¶
Allowed to take this action, but only because requester is admin.
- ContentVersion = 47¶
A Version mismatch in content transmitted within the Steam protocol.
- TryAnotherCM = 48¶
The current CM can’t service the user making a request, should try another.
- PasswordRequiredToKickSession = 49¶
You are already logged in elsewhere, this cached credential login has failed.
- AlreadyLoggedInElsewhere = 50¶
You are already logged in elsewhere, you must wait.
- Suspended = 51¶
Long running operation (content download) suspended/paused.
- Cancelled = 52¶
Operation canceled (typically by user content download).
- DataCorruption = 53¶
Operation canceled because data is malformed or unrecoverable.
- DiskFull = 54¶
Operation canceled - not enough disk space.
- RemoteCallFailed = 55¶
An remote call or IPC call failed.
- ExternalAccountUnlinked = 57¶
External account is not linked to a Steam account.
- PSNTicketInvalid = 58¶
PSN ticket was invalid.
- ExternalAccountAlreadyLinked = 59¶
External account is already linked to some other account.
- RemoteFileConflict = 60¶
The sync cannot resume due to a conflict between the local and remote files.
- IllegalPassword = 61¶
The requested new password is not legal.
- SameAsPreviousValue = 62¶
New value is the same as the old one (secret question and answer).
- AccountLogonDenied = 63¶
Account login denied due to 2nd factor authentication failure.
- CannotUseOldPassword = 64¶
The requested new password is not legal.
- InvalidLoginAuthCode = 65¶
Account login denied due to auth code invalid.
- AccountLogonDeniedNoMail = 66¶
Account login denied due to 2nd factor authentication failure.
- HardwareNotCapableOfIPT = 67¶
The user’s hardware does not support Intel’s identity protection technology.
- IPTInitError = 68¶
Intel’s Identity Protection Technology has failed to initialize.
- ParentalControlRestricted = 69¶
Operation failed due to parental control restrictions for current user.
- FacebookQueryError = 70¶
Facebook query returned an error.
- ExpiredLoginAuthCode = 71¶
Account login denied due to auth code expired.
- IPLoginRestrictionFailed = 72¶
The login failed due to an IP restriction.
- AccountLockedDown = 73¶
The current users account is currently locked for use.
- VerifiedEmailRequired = 74¶
The logon failed because the accounts email is not verified.
- NoMatchingURL = 75¶
There is no url matching the provided values.
- BadResponse = 76¶
Parse failure, missing field, etc.
- RequirePasswordReEntry = 77¶
The user cannot complete the action until they re-enter their password.
- ValueOutOfRange = 78¶
The value entered is outside the acceptable range.
- UnexpectedError = 79¶
Something happened that we didn’t expect to ever happen.
- Disabled = 80¶
The requested service has been configured to be unavailable.
- InvalidCEGSubmission = 81¶
The set of files submitted to the CEG server are not valid.
- RestrictedDevice = 82¶
The device being used is not allowed to perform this action.
- RegionLocked = 83¶
The action could not be complete because it is region restricted.
- RateLimitExceeded = 84¶
Temporary rate limit exceeded. Different from
LimitExceeded.
- LoginDeniedNeedTwoFactor = 85¶
Need two-factor code to log in.
- ItemDeleted = 86¶
The thing we’re trying to access has been deleted.
- AccountLoginDeniedThrottle = 87¶
Login attempt failed, try to throttle response to possible attacker.
- TwoFactorCodeMismatch = 88¶
Two-factor code mismatch.
- TwoFactorActivationCodeMismatch = 89¶
Activation code for two-factor didn’t match.
- NotModified = 91¶
Data not modified.
- TimeNotSynced = 93¶
The time presented is out of range or tolerance.
- SMSCodeFailed = 94¶
SMS code failure (no match, none pending, etc.).
- AccountActivityLimitExceeded = 96¶
Too many changes to this account.
- PhoneActivityLimitExceeded = 97¶
Too many changes to this phone.
- RefundToWallet = 98¶
Cannot refund to payment method, must use wallet.
- EmailSendFailure = 99¶
Cannot send an email.
- NotSettled = 100¶
Can’t perform operation till payment has settled.
- NeedCaptcha = 101¶
Needs to provide a valid captcha.
- GSLTDenied = 102¶
A game server login token owned by this token’s owner has been banned.
- GSOwnerDenied = 103¶
Game server owner is denied for other reason.
- InvalidItemType = 104¶
The type of thing we were requested to act on is invalid.
- IPBanned = 105¶
The IP address has been banned from taking this action.
- GSLTExpired = 106¶
This Game Server Login Token has expired from disuse; can be reset for use.
- InsufficientFunds = 107¶
User doesn’t have enough wallet funds to complete the action.
- TooManyPending = 108¶
There are too many of this thing pending already.
- NoSiteLicensesFound = 109¶
No site licenses found.
- WGNetworkSendExceeded = 110¶
The WG couldn’t send a response because we exceeded max network send size.
- AccountNotFriends = 111¶
Not friends with the relevant account.
- LimitedUserAccount = 112¶
The account is limited and cannot perform this action.
- CantRemoveItem = 113¶
Cannot remove the item.
- AccountHasBeenDeleted = 114¶
The relevant account has been deleted.
- AccountHasCancelledLicense = 115¶
The user has a user cancelled license.
- DeniedDueToCommunityCooldown = 116¶
The request was denied due to community cooldown.
- NoLauncherSpecified = 117¶
No launcher was specified.
- MustAgreeToSSA = 118¶
User must agree to China SSA or global SSA before login.
- LauncherMigrated = 119¶
The specified launcher type is no longer supported.
- SteamRealmMismatch = 120¶
The user’s realm does not match the realm of the requested resource.
- InvalidSignature = 121¶
Signature check did not match.
- ParseFailure = 122¶
Failed to parse input.
- NoVerifiedPhone = 123¶
Account does not have a verified phone number.
- InsufficientBatteryCharge = 124¶
The device battery is too low to complete the action.
- class steam.Language¶
An enumeration.
- NONE = -1¶
- English = 0¶
- German = 1¶
- French = 2¶
- Italian = 3¶
- Korean = 4¶
- Spanish = 5¶
- SimplifiedChinese = 6¶
- TraditionalChinese = 7¶
- Russian = 8¶
- Thai = 9¶
- Japanese = 10¶
- Portuguese = 11¶
- Polish = 12¶
- Danish = 13¶
- Dutch = 14¶
- Finnish = 15¶
- Norwegian = 16¶
- Swedish = 17¶
- Romanian = 18¶
- Turkish = 19¶
- Hungarian = 20¶
- Czech = 21¶
- PortugueseBrazil = 22¶
- Bulgarian = 23¶
- Greek = 24¶
- Arabic = 25¶
- Ukrainian = 26¶
- SpanishLatinAmerican = 27¶
- Vietnamese = 28¶
- NATIVE_NAME_MAP = {Language.English: 'English', Language.German: 'Deutsch', Language.French: 'Français', Language.Italian: 'Italiano', Language.Korean: '한국어', Language.Spanish: 'Español-España', Language.SimplifiedChinese: '简体中文', Language.TraditionalChinese: '繁體中文', Language.Russian: 'Русский', Language.Thai: 'ไทย', Language.Japanese: '日本語', Language.Portuguese: 'Português', Language.Polish: 'Polski', Language.Danish: 'Dansk', Language.Dutch: 'Nederlands', Language.Finnish: 'Suomi', Language.Norwegian: 'Norsk', Language.Swedish: 'Svenska', Language.Romanian: 'Română', Language.Turkish: 'Türkçe', Language.Hungarian: 'Magyar', Language.Czech: 'čeština', Language.PortugueseBrazil: 'Português-Brasil', Language.Bulgarian: 'езбългарски езикик', Language.Greek: 'Ελληνικά', Language.Arabic: 'العربية', Language.Ukrainian: 'Українська', Language.SpanishLatinAmerican: 'Español-Latinoamérica', Language.Vietnamese: 'Tiếng Việt'}¶
- API_LANGUAGE_MAP = {Language.English: 'english', Language.German: 'german', Language.French: 'french', Language.Italian: 'italian', Language.Korean: 'koreana', Language.Spanish: 'spanish', Language.SimplifiedChinese: 'schinese', Language.TraditionalChinese: 'tchinese', Language.Russian: 'russian', Language.Thai: 'thai', Language.Japanese: 'japanese', Language.Portuguese: 'portuguese', Language.Polish: 'polish', Language.Danish: 'danish', Language.Dutch: 'dutch', Language.Finnish: 'finnish', Language.Norwegian: 'norwegian', Language.Swedish: 'swedish', Language.Romanian: 'romanian', Language.Turkish: 'turkish', Language.Hungarian: 'hungarian', Language.Czech: 'czech', Language.PortugueseBrazil: 'brazilian', Language.Bulgarian: 'bulgarian', Language.Greek: 'greek', Language.Arabic: 'arabic', Language.Ukrainian: 'ukrainian', Language.SpanishLatinAmerican: 'latam', Language.Vietnamese: 'vietnamese'}¶
- WEB_API_MAP = {Language.English: 'en', Language.German: 'de', Language.French: 'fr', Language.Italian: 'it', Language.Korean: 'ko', Language.Spanish: 'es', Language.SimplifiedChinese: 'zh-CN', Language.TraditionalChinese: 'zh-TW', Language.Russian: 'ru', Language.Thai: 'th', Language.Japanese: 'ja', Language.Portuguese: 'pt', Language.Polish: 'pl', Language.Danish: 'da', Language.Dutch: 'nl', Language.Finnish: 'fi', Language.Norwegian: 'no', Language.Swedish: 'sv', Language.Romanian: 'ro', Language.Turkish: 'tr', Language.Hungarian: 'hu', Language.Czech: 'cs', Language.PortugueseBrazil: 'pt-BR', Language.Bulgarian: 'bg', Language.Greek: 'el', Language.Arabic: 'ar', Language.Ukrainian: 'uk', Language.SpanishLatinAmerican: 'es-419', Language.Vietnamese: 'vn'}¶
- classmethod from_str(string)¶
- Return type:
Self
- class steam.Universe¶
An enumeration.
- Invalid = 0¶
Invalid.
- Public = 1¶
The standard public universe.
- Beta = 2¶
Beta universe used inside Valve.
- Internal = 3¶
Internal universe used inside Valve.
- Dev = 4¶
Dev universe used inside Valve.
- Max = 6¶
Total number of universes, used for sanity checks.
- class steam.Type¶
An enumeration.
- Invalid = 0¶
Used for invalid Steam IDs.
- Individual = 1¶
Single user account.
- Multiseat = 2¶
Multiseat (e.g. cybercafe) account.
- GameServer = 3¶
Game server account.
- AnonGameServer = 4¶
Anonymous game server account.
- Pending = 5¶
Pending.
- ContentServer = 6¶
Valve internal content server account.
- Clan = 7¶
Steam clan.
- Chat = 8¶
Steam group chat or lobby.
- ConsoleUser = 9¶
Fake SteamID for local PSN account on PS3 or Live account on 360, etc.
- AnonUser = 10¶
Anonymous user account. (Used to create an account or reset a password)
- Max = 11¶
Max of 16 items in this field
- class steam.TypeChar¶
An enumeration.
- U = 1¶
The character used for
Individual.
- G = 3¶
The character used for
GameServer.
- A = 4¶
The character used for
AnonGameServer.
- C = 6¶
The character used for
ContentServer.
- class steam.InstanceFlag¶
An enumeration.
- All = 0¶
The Instance for all Steam IDs
- Desktop = 1¶
The Instance for desktop Steam IDs
- Console = 2¶
The Instance for console Steam IDs
- Web = 4¶
The Instance for web Steam IDs
- Unknown1 = 8¶
- Unknown2 = 16¶
- Unknown3 = 32¶
- Unknown4 = 64¶
- Unknown5 = 128¶
- Unknown6 = 256¶
- Unknown7 = 512¶
- Unknown8 = 1024¶
- Unknown9 = 2048¶
- Unknown10 = 4096¶
- Unknown11 = 8192¶
- Unknown12 = 16384¶
- ChatMMSLobby = 131072¶
The Steam ID is for an MMS Lobby.
- ChatLobby = 262144¶
The Steam ID is for a Lobby.
- ChatClan = 524288¶
The Steam ID is for a Clan.
- class steam.FriendRelationship¶
An enumeration.
- NONE = 0¶
The user has no relationship to you.
- Blocked = 1¶
The user has been blocked.
- RequestRecipient = 2¶
The user has requested to be friends with you.
- Friend = 3¶
The user is friends with you.
- RequestInitiator = 4¶
You have requested to be friends with the user.
- Ignored = 5¶
You have explicitly blocked this other user from comments/chat/etc.
- IgnoredFriend = 6¶
The user has ignored the current user.
- Max = 8¶
The total number of friend relationships used for looping and verification.
- class steam.PersonaState¶
An enumeration.
- Offline = 0¶
The user is not currently logged on.
- Online = 1¶
The user is logged on.
- Busy = 2¶
The user is on, but busy.
- Away = 3¶
The user has been marked as AFK for a short period of time.
- Snooze = 4¶
The user has been marked as AFK for a long period of time.
- LookingToTrade = 5¶
The user is online and wanting to trade.
- LookingToPlay = 6¶
The user is online and wanting to play.
- Invisible = 7¶
The user is invisible.
- Max = 8¶
The total number of states. Only used for looping and validation.
- class steam.PersonaStateFlag¶
An enumeration.
- NONE = 0¶
- HasRichPresence = 1¶
- InJoinableGame = 2¶
- Golden = 4¶
- RemotePlayTogether = 8¶
- ClientTypeWeb = 16¶
- ClientTypeMobile = 256¶
- ClientTypeTenfoot = 1024¶
- ClientTypeVR = 2048¶
- LaunchTypeGamepad = 4096¶
- LaunchTypeCompatTool = 8192¶
- class steam.CommunityVisibilityState¶
An enumeration.
- NONE = 0¶
The user has no community state.
- Private = 1¶
The user has a private profile.
- FriendsOnly = 2¶
The user has a friends only profile.
- Public = 3¶
The user has a public profile.
- class steam.TradeOfferState¶
An enumeration.
- Invalid = 1¶
The trade offer’s state is invalid.
- Active = 2¶
The trade offer is active.
- Accepted = 3¶
The trade offer has been accepted.
- Countered = 4¶
The trade offer has been countered.
- Expired = 5¶
The trade offer has expired.
- Canceled = 6¶
The trade offer has been cancelled.
- Declined = 7¶
The trade offer has be declined by the partner.
- InvalidItems = 8¶
The trade offer has invalid items and has been cancelled.
- ConfirmationNeed = 9¶
The trade offer needs confirmation.
- CanceledBySecondaryFactor = 10¶
The trade offer was cancelled by second factor.
- StateInEscrow = 11¶
The trade offer is in escrow.
- class steam.ChatEntryType¶
An enumeration.
- Invalid = 0¶
An Invalid Chat entry.
- Text = 1¶
A Normal text message from another user.
- Typing = 2¶
Another user is typing (not used in multi-user chat).
- InviteGame = 3¶
An Invite from other user into that users current game.
- LeftConversation = 6¶
A user has left the conversation.
- Entered = 7¶
A user has entered the conversation (used in multi-user chat and group chat).
- WasKicked = 8¶
A user was kicked.
- WasBanned = 9¶
A user was banned.
- Disconnected = 10¶
A user disconnected.
- HistoricalChat = 11¶
A chat message from user’s chat history or offline message.
- LinkBlocked = 14¶
A link was removed by the chat filter.
- class steam.UIMode¶
An enumeration.
- Desktop = 0¶
The UI mode for the desktop client.
- BigPicture = 1¶
The UI mode for big picture mode.
- Mobile = 2¶
The UI mode for mobile.
- Web = 3¶
The UI mode for the web client.
- class steam.UserBadge¶
An enumeration.
- Invalid = 0¶
Invalid Badge.
- YearsOfService = 1¶
The years of service badge.
- Community = 2¶
The pillar of the community badge.
- Portal2PotatoARG = 3¶
The portal to potato badge.
- TreasureHunt = 4¶
The treasure hunter badge.
- SummerSale2011 = 5¶
The Summer sale badge for 2011.
- WinterSale2011 = 6¶
The Winter sale badge for 2011.
- SummerSale2012 = 7¶
The Summer sale badge for 2012.
- WinterSale2012 = 8¶
The Winter sale badge for 2012.
- CommunityTranslator = 9¶
The community translator badge.
- CommunityModerator = 10¶
The community moderator badge.
- ValveEmployee = 11¶
The Valve employee badge.
- GameDeveloper = 12¶
The game developer badge.
- GameCollector = 13¶
The game collector badge.
- TradingCardBetaParticipant = 14¶
The trading card beta participant badge.
- SteamBoxBeta = 15¶
The Steam box beta badge.
- Summer2014RedTeam = 16¶
The Summer sale badge for 2014 for the red team.
- Summer2014BlueTeam = 17¶
The Summer sale badge for 2014 for the blue team.
- Summer2014PinkTeam = 18¶
The Summer sale badge for 2014 for the pink team.
- Summer2014GreenTeam = 19¶
The Summer sale badge for 2014 for the green team.
- Summer2014PurpleTeam = 20¶
The Summer sale badge for 2014 for the purple team.
- Auction2014 = 21¶
The auction badge for 2014.
- GoldenProfile2014 = 22¶
The golden profile for 2014.
- TowerAttackMiniGame = 23¶
The tower attack mini-game badge.
- Winter2015ARGRedHerring = 24¶
The Winter ARG red herring badge for 2015.
- SteamAwards2016Nominations = 25¶
The Steam Awards Nominations badge for 2016.
- StickerCompletionist2017 = 26¶
The sticker completionist badge for 2017.
- SteamAwards2017Nominations = 27¶
The Steam Awards Nominations badge for 2017.
- SpringCleaning2018 = 28¶
The Spring cleaning badge for 2018.
- Salien = 29¶
The Salien badge.
- RetiredModerator = 30¶
The retired moderator badge.
- SteamAwards2018Nominations = 31¶
The Steam Awards Nominations badge for 2018.
- ValveModerator = 32¶
The Valve moderator badge.
- WinterSale2018 = 33¶
The Winter sale badge for 2018.
- LunarNewYearSale2019 = 34¶
The lunar new years sale badge for 2019.
- LunarNewYearSale2019GoldenProfile = 35¶
The lunar new year golden profile sale badge for 2019.
- SpringCleaning2019 = 36¶
The Spring cleaning badge for 2019.
- Summer2019 = 37¶
The Summer sale badge for 2019.
- Summer2019TeamHare = 38¶
The Summer sale badge for 2014 for team hare.
- Summer2019TeamTortoise = 39¶
The Summer sale badge for 2014 for team tortoise.
- Summer2019TeamCorgi = 40¶
The Summer sale badge for 2014 for team corgi.
- Summer2019TeamCockatiel = 41¶
The Summer sale badge for 2014 for team cockatiel.
- Summer2019TeamPig = 42¶
The Summer sale badge for 2014 for team pig.
- SteamAwards2019Nominations = 43¶
The Steam Awards Nominations badge for 2019.
- WinterSaleEvent2019 = 44¶
The Winter sale badge for 2019.
- WinterSale2019Steamville = 45¶
The Winter sale Steamville badge for 2019.
- LunarNewYearSale2020 = 46¶
The lunar new years sale badge for 2020.
- SpringCleaning2020 = 47¶
The Spring cleaning badge for 2020.
- AwardsCommunityContributor = 48¶
The Steam Awards Community Contributor badge.
- AwardsCommunityPatron = 49¶
The Steam Awards Community Patron badge.
- SteamAwards2020Nominations = 50¶
The Steam Awards Nominations badge for 2020.
- class steam.ReviewType¶
An enumeration.
- NONE = 0¶
No reviews.
- OverwhelminglyNegative = 1¶
0 - 19% positive reviews and few of them.
- VeryNegative = 2¶
0 - 19% positive reviews.
- Negative = 3¶
0 - 39% positive reviews.
- MostlyNegative = 4¶
20 - 39% positive reviews but few of them.
- Mixed = 5¶
40 - 69% positive reviews.
- MostlyPositive = 6¶
70 - 79% positive reviews.
- Positive = 7¶
80 - 100% positive reviews but few of them.
- VeryPositive = 8¶
94 - 80% positive reviews.
- OverwhelminglyPositive = 9¶
95 - 100% positive reviews.
- class steam.GameServerRegion¶
An enumeration.
- NONE = -1¶
No set game region.
- USEastCoast = 0¶
A server on the USA’s East Coast.
- USWestCoast = 1¶
A server on the USA’s West Coast.
- SouthAmerica = 2¶
A server in South America.
- Europe = 3¶
A server in Europe.
- Asia = 4¶
A server in Asia.
- Australia = 5¶
A server in Australia.
- MiddleEast = 6¶
A server in the Middle East.
- Africa = 7¶
A server in Africa.
- World = 255¶
A server somewhere in the world.
- class steam.EventType¶
An enumeration.
- Other = 1¶
An unspecified event.
- Game = 2¶
A game event.
- Party = 3¶
A party event.
- Meeting = 4¶
An important meeting.
- SpecialCause = 5¶
An event for a special cause.
- MusicAndArts = 6¶
A music or art event.
- Sports = 7¶
A sporting event.
- Trip = 8¶
A clan trip.
- Chat = 9¶
A chat event.
- GameRelease = 10¶
A game release event.
- Broadcast = 11¶
A broadcast event.
- SmallUpdate = 12¶
A small update event.
- PreAnnounceMajorUpdate = 13¶
A pre-announcement for a major update event.
- MajorUpdate = 14¶
A major update event.
- DLCRelease = 15¶
A dlc release event.
- FutureRelease = 16¶
A future release event.
- ESportTournamentStream = 17¶
An e-sport tournament stream event.
- DevStream = 18¶
A developer stream event.
- FamousStream = 19¶
A famous stream event.
- GameSales = 20¶
A game sales event.
- GameItemSales = 21¶
A game item sales event.
- InGameBonusXP = 22¶
An in game bonus xp event.
- InGameLoot = 23¶
An in game loot event.
- InGamePerks = 24¶
An in game perks event.
- InGameChallenge = 25¶
An in game challenge event.
- InGameContest = 26¶
An in game contest event.
- IRL = 27¶
An in real life event.
- News = 28¶
A news event.
- BetaRelease = 29¶
A beta release event.
- InGameContentRelease = 30¶
An in game content release event.
- FreeTrial = 31¶
A free trial event.
- SeasonRelease = 32¶
A season release event.
- SeasonUpdate = 33¶
A season update event.
- Crosspost = 34¶
A cross post event.
- InGameGeneral = 35¶
An in game general event.
- class steam.ProfileItemType¶
An enumeration.
- Invalid = 0¶
An invalid item type.
- RareAchievementShowcase = 1¶
A rare achievements showcase.
- GameCollector = 2¶
A game collector section.
- ItemShowcase = 3¶
An item showcase.
- TradeShowcase = 4¶
A trade info showcase.
- Badges = 5¶
A badges showcase.
- FavouriteGame = 6¶
A favourite game section.
- ScreenshotShowcase = 7¶
A screenshot showcase.
- CustomText = 8¶
A custom text section.
- FavouriteGroup = 9¶
A favourite game showcase.
- Recommendation = 10¶
A review showcase.
- WorkshopItem = 11¶
A workshop item showcase.
- MyWorkshop = 12¶
A showcase of a workshop item made by profile’s owner.
- ArtworkShowcase = 13¶
An artwork showcase.
- VideoShowcase = 14¶
A video showcase.
- Guides = 15¶
A guide showcase.
- MyGuides = 16¶
A showcase of the profile’s owner’s guides.
- Achievements = 17¶
The owner’s profile’s achievements.
- Greenlight = 18¶
A greenlight showcase.
- MyGreenlight = 19¶
A showcase of a greenlight game the profiles’ owner has made.
- Salien = 20¶
A salien showcase.
- LoyaltyRewardReactions = 21¶
A loyalty reward showcase.
- SingleArtworkShowcase = 22¶
A single artwork showcase.
- AchievementsCompletionist = 23¶
An achievements completeionist showcase.
- class steam.DepotFileFlag¶
An enumeration.
- File = 0¶
- UserConfig = 1¶
- VersionedUserConfig = 2¶
- Encrypted = 4¶
- ReadOnly = 8¶
- Hidden = 16¶
- Executable = 32¶
- Directory = 64¶
- CustomExecutable = 128¶
- InstallScript = 256¶
- Symlink = 512¶
- class steam.AppFlag¶
An enumeration.
- Game = 1¶
- Application = 2¶
- Tool = 4¶
- Demo = 8¶
- Deprecated = 16¶
- DLC = 32¶
- Guide = 64¶
- Driver = 128¶
- Config = 256¶
- Hardware = 512¶
- Franchise = 1024¶
- Video = 2048¶
- Plugin = 4096¶
- Music = 8192¶
- Series = 16384¶
- Comic = 32768¶
- Beta = 65536¶
- Shortcut = 1073741824¶
- DepotOnly = -2147483648¶
- classmethod from_str(name)¶
- Return type:
Self
- class steam.LicenseFlag¶
An enumeration.
- NONE = 0¶
- Renew = 1¶
- RenewalFailed = 2¶
- Pending = 4¶
- Expired = 8¶
- CancelledByUser = 16¶
- CancelledByAdmin = 32¶
- LowViolenceContent = 64¶
- ImportedFromSteam2 = 128¶
- ForceRunRestriction = 256¶
- RegionRestrictionExpired = 512¶
- CancelledByFriendlyFraudLock = 1024¶
- NotActivated = 2048¶
- class steam.LicenseType¶
An enumeration.
- NoLicense = 0¶
- SinglePurchase = 1¶
- SinglePurchaseLimitedUse = 2¶
- RecurringCharge = 3¶
- RecurringChargeLimitedUse = 4¶
- RecurringChargeLimitedUseWithOverages = 5¶
- RecurringOption = 6¶
- LimitedUseDelayedActivation = 7¶
- class steam.BillingType¶
An enumeration.
- NoCost = 0¶
- BillOnceOnly = 1¶
- BillMonthly = 2¶
- ProofOfPrepurchaseOnly = 3¶
- GuestPass = 4¶
- HardwarePromo = 5¶
- Gift = 6¶
- AutoGrant = 7¶
- OEMTicket = 8¶
- RecurringOption = 9¶
- BillOnceOrCDKey = 10¶
- Repurchaseable = 11¶
- FreeOnDemand = 12¶
- Rental = 13¶
- CommercialLicense = 14¶
- FreeCommercialLicense = 15¶
- NumBillingTypes = 16¶
- class steam.PaymentMethod¶
An enumeration.
- NONE = 0¶
- ActivationCode = 1¶
- CreditCard = 2¶
- Giropay = 3¶
- PayPal = 4¶
- Ideal = 5¶
- PaySafeCard = 6¶
- Sofort = 7¶
- GuestPass = 8¶
- WebMoney = 9¶
- MoneyBookers = 10¶
- AliPay = 11¶
- Yandex = 12¶
- Kiosk = 13¶
- Qiwi = 14¶
- GameStop = 15¶
- HardwarePromo = 16¶
- MoPay = 17¶
- BoletoBancario = 18¶
- BoaCompraGold = 19¶
- BancoDoBrasilOnline = 20¶
- ItauOnline = 21¶
- BradescoOnline = 22¶
- Pagseguro = 23¶
- VisaBrazil = 24¶
- AmexBrazil = 25¶
- Aura = 26¶
- Hipercard = 27¶
- MastercardBrazil = 28¶
- DinersCardBrazil = 29¶
- AuthorizedDevice = 30¶
- MOLPoints = 31¶
- ClickAndBuy = 32¶
- Beeline = 33¶
- Konbini = 34¶
- EClubPoints = 35¶
- CreditCardJapan = 36¶
- BankTransferJapan = 37¶
- PayEasy = 38¶
- Zong = 39¶
- CultureVoucher = 40¶
- BookVoucher = 41¶
- HappymoneyVoucher = 42¶
- ConvenientStoreVoucher = 43¶
- GameVoucher = 44¶
- Multibanco = 45¶
- Payshop = 46¶
- MaestroBoaCompra = 47¶
- OXXO = 48¶
- ToditoCash = 49¶
- Carnet = 50¶
- SPEI = 51¶
- ThreePay = 52¶
- IsBank = 53¶
- Garanti = 54¶
- Akbank = 55¶
- YapiKredi = 56¶
- Halkbank = 57¶
- BankAsya = 58¶
- Finansbank = 59¶
- DenizBank = 60¶
- PTT = 61¶
- CashU = 62¶
- AutoGrant = 64¶
- WebMoneyJapan = 65¶
- OneCard = 66¶
- PSE = 67¶
- Exito = 68¶
- Efecty = 69¶
- Paloto = 70¶
- PinValidda = 71¶
- MangirKart = 72¶
- BancoCreditoDePeru = 73¶
- BBVAContinental = 74¶
- SafetyPay = 75¶
- PagoEfectivo = 76¶
- Trustly = 77¶
- UnionPay = 78¶
- BitCoin = 79¶
- Wallet = 128¶
- Valve = 129¶
- MasterComp = 130¶
- Promotional = 131¶
- MasterSubscription = 134¶
- Payco = 135¶
- MobileWalletJapan = 136¶
- OEMTicket = 256¶
- Split = 512¶
- Complimentary = 1024¶
Guard¶
- steam.guard.generate_one_time_code(shared_secret, timestamp=None)¶
Generate a Steam Guard code for signing in or at a specific time.
- steam.guard.generate_confirmation_code(identity_secret, tag, timestamp=None)¶
Generate a trade confirmation code.
Async Iterators¶
An async iterator is a class that is capable of being used with the syntax async for.
They can be used as follows:
async for trade in client.trade_history():
... # do stuff with trade here
- class steam.iterators.AsyncIterator¶
A class from which async iterators (see PEP 525) can ben easily derived.
- async for y in x
Iterates over the contents of the async iterator.
- before¶
When to find objects before.
- Type:
- after¶
When to find objects after.
- Type:
- await get(**attrs)¶
A helper function which is similar to
get()except it runs over the async iterator.This is roughly equivalent to:
elements = await async_iterator.flatten() element = steam.utils.get(elements, name="Item")
Example
Getting the last comment from a user named ‘Dave’ or None:
comment = await user.comments().get(author__name="Dave")
- await find(predicate)¶
A helper function which is similar to
find()except it runs over the async iterator. However, unlikefind(), the predicate provided can be a coroutine.This is roughly equivalent to:
elements = await async_iterator.flatten() element = steam.utils.find(elements, lambda e: e.name == "Item")
Example
Getting the last trade with a message or None:
def predicate(trade: steam.TradeOffer) -> bool: return trade.message is not None trade = await client.trade_history().find(predicate)
- Parameters:
predicate (MaybeCoro[T]) – A callable/coroutine that returns a boolean.
- Returns:
The first element from the iterator for which the
predicatereturnsTrueorNoneif no matching element was found.- Return type:
Optional[steam.iterators.T]
- await flatten()¶
A helper function that iterates over the
AsyncIteratorreturning a list of all the elements in the iterator.This is equivalent to:
elements = [element async for element in async_iterator]
- Return type:
list[steam.iterators.T]
- filter(predicate)¶
Filter members of the async iterator according to a predicate. This function acts similarly to
filter().Examples
for dave in async_iterator.filter(lambda x: x.name == "Dave"): ... # the element now has to have a name of Dave.
- map(func)¶
Map the elements of the async iterator through a function. This function acts similarly to
map().Examples
for name in async_iterator.map(lambda x: x.name): ... # name is now the iterators element's name.
- await next()¶
Advances the iterator by one, if possible.
- Raises:
StopAsyncIteration – There are no more elements in the iterator.
- Return type:
steam.iterators.T
Abstract Base Classes¶
An abstract base class (also known as an abc) is a class that models can inherit their behaviour from.
- asyncbadges
- asyncbans
- asyncclans
- asynccomment
- async forcomments
- asyncequipped_profile_items
- asyncfavourite_badge
- asyncfetch_comment
- asyncfetch_review
- asyncfetch_reviews
- asyncfriends
- asyncgames
- asyncinventory
- asyncis_banned
- defis_commentable
- defis_private
- defis_valid
- asynclevel
- asyncprofile
- asyncprofile_customisation_info
- async forpublished_files
- async forreviews
- asyncwishlist
- class steam.abc.BaseUser¶
An ABC that details the common operations on a Steam user. The following classes implement this ABC:
- x == y
Checks if two users are equal.
- str(x)
Returns the user’s name.
- state¶
The current persona state of the account (e.g. LookingToTrade).
- Type:
Optional[steam.enums.PersonaState]
- game¶
The Game instance attached to the user. Is
Noneif the user isn’t in a game or one that is recognised by the api.- Type:
Optional[steam.game.StatefulGame]
- primary_clan¶
The primary clan the User displays on their profile.
Note
This can be lazily awaited to get more attributes of the clan.
- Type:
Optional[steam.clan.Clan]
- created_at¶
The time at which the user’s account was created. Could be
None.- Type:
Optional[datetime.datetime]
- last_logoff¶
The last time the user logged into steam. Could be None (e.g. if they are currently online).
- Type:
Optional[datetime.datetime]
- flags¶
The persona state flags of the account.
- Type:
Optional[steam.enums.PersonaStateFlag]
- await inventory(game, *, language=None)¶
Fetch a user’s
Inventoryfor trading.- Parameters:
- Raises:
Forbidden – The user’s inventory is private.
- Return type:
steam.trade.BaseInventory[steam.trade.Item]
- await friends()¶
Fetch the list of the users friends.
- Return type:
- await games(*, include_free=True)¶
Fetches the
Games the user owns.- Parameters:
include_free (bool) – Whether to include free games in the list. Defaults to
True.- Return type:
- await badges()¶
Fetches the user’s
UserBadgess.- Return type:
- await level()¶
Fetches the user’s level if your account is premium, otherwise it’s cached.
- Return type:
- await wishlist()¶
Get the
WishlistGames the user has on their wishlist.- Return type:
- await favourite_badge()¶
The user’s favourite badge.
- Return type:
- await equipped_profile_items(*, language=None)¶
The user’s equipped profile items.
- await profile_customisation_info(*, language=None)¶
Fetch a user’s profile customisation information.
- await profile(*, language=None)¶
Fetch a user’s entire profile information.
- Parameters:
language (Optional[Language]) – The language to fetch the profile items in. If
Nonethe current language is used
Note
This calls all the profile related functions to return a Profile object which has all the info set.
- Return type:
- await is_banned()¶
Specifies if the user is banned from any part of Steam.
Shorthand for:
bans = await user.bans() bans.is_banned()
- Return type:
- async for ... in reviews(*, limit=None, before=None, after=None)¶
An
AsyncIteratorfor accessing a user’sReviews.Examples
Usage:
async for review in user.reviews(limit=10): print(f"Author: {review.author} {'recommended' if review.recommend 'doesn\'t recommend'} {review.game}")
Flattening into a list:
reviews = await user.reviews(limit=50).flatten() # reviews is now a list of Review
All parameters are optional.
- await fetch_review(game)¶
Fetch this user’s review for a game.
- Parameters:
game (Game) – The games to fetch the reviews for.
- Return type:
- await fetch_reviews(*games)¶
Fetch this user’s review for games.
- Parameters:
games (Game) – The games to fetch the reviews for.
- Return type:
- async for ... in published_files(*, game=None, revision=PublishedFileRevision.Default, type=PublishedFileType.Community, language=None, limit=None, before=None, after=None)¶
An
AsyncIteratorfor accessing a user’sPublishedFiles.Examples
Usage:
async for file in user.published_files(limit=10): print("Author:", file.author, "Published:", file.name)
Flattening into a list:
files = await user.published_files(limit=50).flatten() # files is now a list of PublishedFile
All parameters are optional.
- Parameters:
game (Optional[Game]) – The game to fetch published files in.
type (PublishedFileType) – The type of published file to fetch.
revision (PublishedFileRevision) – The desired revision of the published file to fetch.
language (Optional[Language]) – The language to fetch the published file in. If
None, the current language is used.limit (Optional[int]) – The maximum number of published files to search through. Setting this to
Nonewill fetch all of the user’s published files.before (Optional[datetime]) – A time to search for published files before.
after (Optional[datetime]) – A time to search for published files after.
- Yields:
- await comment(content, *, subscribe=True)¶
Post a comment to a comments section.
- Parameters:
- Returns:
The created comment.
- Return type:
- comments(*, oldest_first=False, limit=None, before=None, after=None)¶
An
AsyncIteratorfor accessing a comment section’sCommentobjects.Examples
Usage:
async for comment in commentable.comments(limit=10): print("Author:", comment.author, "Said:", comment.content)
Flattening into a list:
comments = await commentable.comments(limit=50).flatten() # comments is now a list of Comment
All parameters are optional.
- Parameters:
oldest_first (bool) – Whether or not to request comments with the oldest comments first or last. Defaults to
False.limit (int | None) – The maximum number of comments to search through. Default is
Nonewhich will fetch the all the comments in the comments section.before (datetime | None) – A time to search for comments before.
after (datetime | None) – A time to search for comments after.
- Yields:
- await fetch_comment(id)¶
Fetch a comment by its ID.
- Parameters:
id (int) – The ID of the comment to fetch.
- Return type:
- staticmethod await from_url(url, session=None)¶
A helper function creates a SteamID instance from a Steam community url.
Note
See
id64_from_url()for the full parameter list.- Return type:
- property id: ID32¶
The SteamID’s 32-bit ID.
- property id2_zero: str¶
The SteamID’s ID 2 accounted for bugged GoldSrc and Orange Box games.
Note
In these games the accounts
universe,1forType.Public, should be theXcomponent ofSTEAM_X:0:1234however, this was bugged and the value ofXwas0.e.g
STEAM_0:0:1234.
- property id64: ID64¶
The SteamID’s 64-bit ID.
- property instance: InstanceFlag¶
The instance of the SteamID.
- class steam.abc.Channel¶
- abstractmethod history(*, limit=100, before=None, after=None)¶
An
AsyncIteratorfor accessing a channel’ssteam.Messages.Examples
Usage:
async for message in channel.history(limit=10): print("Author:", message.author, "Said:", message.content)
Flattening into a list:
messages = await channel.history(limit=50).flatten() # messages is now a list of Message
All parameters are optional.
- Parameters:
limit (int | None) – The maximum number of messages to search through. Setting this to
Nonewill fetch all of the channel’s messages, but this will be a very slow operation.before (Optional[datetime]) – A time to search for messages before.
after (Optional[datetime]) – A time to search for messages after.
- Yields:
- await send(content=None, image=None)¶
Send a message to a certain destination.
- Parameters:
content (Any) – The content of the message to send.
image (Image | None) – The image to send to the user.
Note
Anything as passed to
contentis implicitly cast to astr.- Raises:
HTTPException – Sending the message failed.
Forbidden – You do not have permission to send the message.
- Returns:
The sent message, only applicable if
contentis passed.- Return type:
Optional[steam.abc.M_co]
- asyncsend
- class steam.abc.Messageable¶
An ABC that details the common operations on a Steam message. The following classes implement this ABC:
- await send(content=None, image=None)¶
Send a message to a certain destination.
- Parameters:
Note
Anything as passed to
contentis implicitly cast to astr.- Raises:
HTTPException – Sending the message failed.
Forbidden – You do not have permission to send the message.
- Returns:
The sent message, only applicable if
contentis passed.- Return type:
Optional[steam.abc.M_co]
Steam Models¶
steam.py provides wrappers around common Steam API objects. These are not meant to be constructed by the user instead you receive them from methods/events.
Announcements¶
- class steam.Announcement(state, clan, data)¶
Represents an announcement in a clan.
- author¶
The announcement’s author.
- Type:
Optional[Union[steam.user.User, steam.abc.SteamID]]
- game¶
The game that the announcement is for.
- Type:
Optional[steam.game.StatefulGame]
- clan¶
The announcement’s clan.
- Type:
- starts_at¶
The announcement’s start time.
- Type:
- becomes_visible¶
The time at which the announcement becomes visible.
- Type:
Optional[datetime.datetime]
- stops_being_visible¶
The time at which the announcement stops being visible.
- Type:
Optional[datetime.datetime]
- ends_at¶
The time at which the announcement ends.
- Type:
Optional[datetime.datetime]
- type¶
The announcement’s type.
- Type:
steam.event.ClanEventT
- last_edited_at¶
The time the announcement was last edited at.
- Type:
Optional[datetime.datetime]
- last_edited_by¶
The user who made the announcement last edited.
- Type:
Optional[Union[steam.user.User, steam.abc.SteamID]]
Whether the announcement is currently hidden.
- Type:
- created_at¶
The time at which the announcement was created at.
- Type:
- updated_at¶
The time at which the announcement was last updated_at.
- Type:
- approved_at¶
The time at which the announcement was approved by a moderator.
- Type:
Optional[datetime.datetime]
- await edit(name=None, content=None)¶
Edit the announcement’s details.
Note
If parameters are omitted they use what they are currently set to.
- await comment(content, *, subscribe=True)¶
Post a comment to a comments section.
- Parameters:
- Returns:
The created comment.
- Return type:
- async for ... in comments(*, oldest_first=False, limit=None, before=None, after=None)¶
An
AsyncIteratorfor accessing a comment section’sCommentobjects.Examples
Usage:
async for comment in commentable.comments(limit=10): print("Author:", comment.author, "Said:", comment.content)
Flattening into a list:
comments = await commentable.comments(limit=50).flatten() # comments is now a list of Comment
All parameters are optional.
- Parameters:
oldest_first (bool) – Whether or not to request comments with the oldest comments first or last. Defaults to
False.limit (Optional[int]) – The maximum number of comments to search through. Default is
Nonewhich will fetch the all the comments in the comments section.before (Optional[datetime]) – A time to search for comments before.
after (Optional[datetime]) – A time to search for comments after.
- Yields:
- await delete()¶
Delete this announcement.
- await fetch_comment(id)¶
Fetch a comment by its ID.
- Parameters:
id (int) – The ID of the comment to fetch.
- Return type:
- await upvote()¶
Upvote this announcement.
- await downvote()¶
Downvote this announcement.
Badge¶
- class steam.Badge¶
Represents a Steam badge.
- game¶
The game associated with the badge.
- Type:
Optional[steam.game.StatefulGame]
- completion_time¶
The time the badge was completed at.
- Type:
- class steam.UserBadges¶
Represents a Steam
User’s badges/level.- xp_needed_for_current_level¶
The amount of XP the user’s current level requires to achieve.
- Type:
- badges¶
A list of the user’s badges.
- Type:
Sequence[steam.Badge]
- class steam.FavouriteBadge¶
Represents a User’s favourite badge.
- game¶
The game associated with the badge.
- Type:
Optional[steam.game.StatefulGame]
Ban¶
- defis_banned
- defis_community_banned
- defis_market_banned
- defis_vac_banned
Channel¶
- async forhistory
- asyncsend
- asynctrigger_typing
- async withtyping
- class steam.DMChannel¶
Represents the channel a DM is sent in.
- participant¶
The recipient of any messages sent.
- Type:
- async with typing()¶
Send a typing indicator continuously to the channel while in the context manager.
Note
This only works in DMs.
Usage:
async with channel.typing(): ... # do your expensive operations
- Return type:
contextlib._AsyncGeneratorContextManager[None]
- await trigger_typing()¶
Send a typing indicator to the channel once.
Note
This only works in DMs.
- async for ... in history(*, limit=100, before=None, after=None)¶
An
AsyncIteratorfor accessing a channel’ssteam.Messages.Examples
Usage:
async for message in channel.history(limit=10): print("Author:", message.author, "Said:", message.content)
Flattening into a list:
messages = await channel.history(limit=50).flatten() # messages is now a list of Message
All parameters are optional.
- Parameters:
limit (int | None) – The maximum number of messages to search through. Setting this to
Nonewill fetch all of the channel’s messages, but this will be a very slow operation.before (Optional[datetime]) – A time to search for messages before.
after (Optional[datetime]) – A time to search for messages after.
- Yields:
- await send(content=None, image=None)¶
Send a message to a certain destination.
- Parameters:
Note
Anything as passed to
contentis implicitly cast to astr.- Raises:
HTTPException – Sending the message failed.
Forbidden – You do not have permission to send the message.
- Returns:
The sent message, only applicable if
contentis passed.- Return type:
Optional[steam.abc.M_co]
- class steam.GroupChannel¶
Represents a group channel.
- name¶
The name of the channel, this could be the same as the
nameif it’s the main channel.- Type:
Optional[str]
- group¶
The group to which messages are sent.
- Type:
Optional[steam.group.Group]
- joined_at¶
The time the client joined the chat.
- Type:
Optional[datetime.datetime]
- last_message¶
The last message sent in the channel.
- Type:
Optional[steam.chat.ChatMessageT]
- history(*, limit=100, before=None, after=None)¶
An
AsyncIteratorfor accessing a channel’ssteam.Messages.Examples
Usage:
async for message in channel.history(limit=10): print("Author:", message.author, "Said:", message.content)
Flattening into a list:
messages = await channel.history(limit=50).flatten() # messages is now a list of Message
All parameters are optional.
- Parameters:
limit (int | None) – The maximum number of messages to search through. Setting this to
Nonewill fetch all of the channel’s messages, but this will be a very slow operation.before (Optional[datetime]) – A time to search for messages before.
after (Optional[datetime]) – A time to search for messages after.
- Yields:
- await send(content=None, image=None)¶
Send a message to a certain destination.
- Parameters:
Note
Anything as passed to
contentis implicitly cast to astr.- Raises:
HTTPException – Sending the message failed.
Forbidden – You do not have permission to send the message.
- Returns:
The sent message, only applicable if
contentis passed.- Return type:
Optional[steam.abc.M_co]
- class steam.ClanChannel¶
Represents a group channel.
- name¶
The name of the channel, this could be the same as the
nameif it’s the main channel.- Type:
Optional[str]
- clan¶
The clan to which messages are sent.
- Type:
Optional[steam.clan.Clan]
- joined_at¶
The time the client joined the chat.
- Type:
Optional[datetime.datetime]
- last_message¶
The last message sent in the channel.
- Type:
Optional[steam.chat.ChatMessageT]
- history(*, limit=100, before=None, after=None)¶
An
AsyncIteratorfor accessing a channel’ssteam.Messages.Examples
Usage:
async for message in channel.history(limit=10): print("Author:", message.author, "Said:", message.content)
Flattening into a list:
messages = await channel.history(limit=50).flatten() # messages is now a list of Message
All parameters are optional.
- Parameters:
limit (int | None) – The maximum number of messages to search through. Setting this to
Nonewill fetch all of the channel’s messages, but this will be a very slow operation.before (Optional[datetime]) – A time to search for messages before.
after (Optional[datetime]) – A time to search for messages after.
- Yields:
- await send(content=None, image=None)¶
Send a message to a certain destination.
- Parameters:
Note
Anything as passed to
contentis implicitly cast to astr.- Raises:
HTTPException – Sending the message failed.
Forbidden – You do not have permission to send the message.
- Returns:
The sent message, only applicable if
contentis passed.- Return type:
Optional[steam.abc.M_co]
Clan¶
- active_member_count
- admins
- avatar_url
- channels
- content
- created_at
- default_channel
- default_role
- description
- from_url
- game
- icon_url
- id
- id2
- id2_zero
- id3
- id64
- in_game_count
- instance
- invite_code
- invite_url
- language
- location
- me
- member_count
- members
- mods
- name
- online_count
- owner
- roles
- tagline
- top_members
- type
- universe
- async forannouncements
- asyncchunk
- asynccomment
- async forcomments
- asynccreate_announcement
- asynccreate_event
- async forevents
- asyncfetch_announcement
- asyncfetch_comment
- asyncfetch_event
- asyncfetch_members
- defget_channel
- defget_member
- defget_role
- asyncinvite
- defis_valid
- asyncjoin
- asyncleave
- asyncsearch
- class steam.Clan¶
Represents a Steam clan.
- x == y
Checks if two clans are equal.
- str(x)
Returns the clan’s name.
- created_at¶
The time the clan was created_at.
- Type:
Optional[datetime.datetime]
- language¶
The language set for the clan.
- Type:
- game¶
The clan’s associated game.
- Type:
Optional[steam.game.StatefulGame]
- owner¶
The clan’s owner.
- await fetch_members()¶
Fetches a clan’s member list.
Note
This can be a very slow operation due to the rate limits on this endpoint.
- Return type:
- property description: str¶
An alias to
content.Deprecated since version 0.8.0: Use
contentinstead.
- property icon_url: str¶
An alias to
avatar_url.Deprecated since version 0.8.0: Use
avatar_urlinstead.
- await join(*, invite_code=None)¶
Joins the clan.
- await leave()¶
Leaves the clan.
- await fetch_event(id)¶
Fetch an event from its ID.
- Parameters:
id (int) – The ID of the event.
- Return type:
- await fetch_announcement(id)¶
Fetch an announcement from its ID.
- Parameters:
id (int) – The ID of the announcement.
- Return type:
- async for ... in events(*, limit=100, before=None, after=None)¶
An
AsyncIteratorover a clan’ssteam.Events.Examples
Usage:
async for event in clan.events(limit=10): print(event.author, "made an event", event.name, "starting at", event.starts_at)
All parameters are optional.
- Parameters:
limit (int | None) – The maximum number of events to search through. Default is
100. Setting this toNonewill fetch all the clan’s events, but this will be a very slow operation.before (Optional[datetime]) – A time to search for events before.
after (Optional[datetime]) – A time to search for events after.
- Yields:
- async for ... in announcements(*, limit=100, before=None, after=None)¶
An
AsyncIteratorover a clan’ssteam.Announcements.Examples
Usage:
async for announcement in clan.announcements(limit=10): print( announcement.author, "made an announcement", announcement.name, "at", announcement.created_at, )
All parameters are optional.
- Parameters:
limit (int | None) – The maximum number of announcements to search through. Default is
100. Setting this toNonewill fetch all of the clan’s announcements, but this will be a very slow operation.before (Optional[datetime]) – A time to search for announcements before.
after (Optional[datetime]) – A time to search for announcements after.
- Yields:
- await comment(content, *, subscribe=True)¶
Post a comment to a comments section.
- Parameters:
- Returns:
The created comment.
- Return type:
- async for ... in comments(*, oldest_first=False, limit=None, before=None, after=None)¶
An
AsyncIteratorfor accessing a comment section’sCommentobjects.Examples
Usage:
async for comment in commentable.comments(limit=10): print("Author:", comment.author, "Said:", comment.content)
Flattening into a list:
comments = await commentable.comments(limit=50).flatten() # comments is now a list of Comment
All parameters are optional.
- Parameters:
oldest_first (bool) – Whether or not to request comments with the oldest comments first or last. Defaults to
False.limit (Optional[int]) – The maximum number of comments to search through. Default is
Nonewhich will fetch the all the comments in the comments section.before (Optional[datetime]) – A time to search for comments before.
after (Optional[datetime]) – A time to search for comments after.
- Yields:
- property default_channel: ChatT¶
The group’s default channel.
- await fetch_comment(id)¶
Fetch a comment by its ID.
- Parameters:
id (int) – The ID of the comment to fetch.
- Return type:
- staticmethod await from_url(url, session=None)¶
A helper function creates a SteamID instance from a Steam community url.
Note
See
id64_from_url()for the full parameter list.- Return type:
- get_channel(id)¶
Get a channel from cache.
- Parameters:
id (int) – The ID of the channel.
- Return type:
ChatT | None
- get_member(id64)¶
Get a member of the chat group by id.
- Parameters:
id64 (ID64) – The 64 bit ID of the member to get.
- Return type:
MemberT | None
- get_role(id)¶
Get a role from cache.
- property id: ID32¶
The SteamID’s 32-bit ID.
- property id2_zero: str¶
The SteamID’s ID 2 accounted for bugged GoldSrc and Orange Box games.
Note
In these games the accounts
universe,1forType.Public, should be theXcomponent ofSTEAM_X:0:1234however, this was bugged and the value ofXwas0.e.g
STEAM_0:0:1234.
- property id64: ID64¶
The SteamID’s 64-bit ID.
- property instance: InstanceFlag¶
The instance of the SteamID.
- await invite(user)¶
Invites a
Userto the chat group.- Parameters:
user (User) – The user to invite to the chat group.
- property invite_code: str | None¶
The SteamID’s invite code in the s.team invite code format.
e.g.
cv-dgb.
- property me: MemberT¶
The client user’s account in this chat group.
- await search(name)¶
Search for members in the chat group.
- await create_event(name: str, content: str, *, type: ~typing.Literal[<EventType.Game: 2>] = EventType.Other, starts_at: datetime.datetime | None = None, game: ~steam.game.Game, server_address: str | None = None, server_password: str | None = None) Game: 2>]]¶
- await create_event(name: str, content: str, *, type: BoringEventT = EventType.Other, starts_at: datetime.datetime | None = None) Event[BoringEventT]
Create an event.
- Parameters:
name – The name of the event
content – The content for the event.
type – The type of the event, defaults to
ClanEvent.Other.game – The game that will be played in the event. Required if type is
ClanEvent.Game.starts_at – The time the event will start at.
server_address – The address of the server that the event will be played on. This is only allowed if
typeisClanEvent.Game.server_password – The password for the server that the event will be played on. This is only allowed if
typeisClanEvent.Game.
Note
It is recommended to use a timezone aware datetime for
start.- Returns:
The created event.
- Return type:
Union[steam.event.Event[Any],steam.event.Event[steam.clan.BoringEventT]]
- await create_announcement(name, content, hidden=False)¶
Create an announcement.
- Parameters:
- Returns:
The created announcement.
- Return type:
Comment¶
- class steam.Comment¶
Represents a comment on a Steam profile.
- x == y
Checks if two comments are equal.
- hash(x)
Returns the comment’s hash.
- author¶
The author of the comment.
- Type:
Union[steam.user.User, steam.user.ClientUser, steam.abc.SteamID]
- created_at¶
The time the comment was posted at.
- Type:
- owner¶
The comment sections owner.
- Type:
steam.comment.OwnerT
- reactions¶
The comment’s reactions.
- Type:
- await report()¶
Reports the comment.
- await delete()¶
Deletes the comment.
Events¶
- class steam.Event(state, clan, data)¶
Represents an event in a clan.
- author¶
The event’s author.
- Type:
Optional[Union[steam.user.User, steam.abc.SteamID]]
- game¶
The game that the event is going to play in.
- Type:
Optional[steam.game.StatefulGame]
- clan¶
The event’s clan.
- Type:
- starts_at¶
The event’s start time.
- Type:
- becomes_visible¶
The time at which the event becomes visible.
- Type:
Optional[datetime.datetime]
- stops_being_visible¶
The time at which the event stops being visible.
- Type:
Optional[datetime.datetime]
- ends_at¶
The time at which the event ends.
- Type:
Optional[datetime.datetime]
- type¶
The event’s type.
- Type:
steam.event.ClanEventT
- last_edited_at¶
The time the event was last edited at.
- Type:
Optional[datetime.datetime]
- last_edited_by¶
The user who made the event last edited.
- Type:
Optional[Union[steam.user.User, steam.abc.SteamID]]
Whether the event is currently hidden.
- Type:
- await server()¶
The server that the game will be run on,
Noneif not found.Note
This is shorthand for
await client.fetch_server(ip=event.server_address)
- Return type:
- await edit(name: str, content: str, *, game: steam.game.Game | None = None, starts_at: datetime.datetime | None = None, server_address: str | None = None, server_password: str | None = None) None¶
- await edit(name: str, content: str, *, type: ~typing.Optional[~typing.Literal[<EventType.Other: 1>, <EventType.Chat: 9>, <EventType.Party: 3>, <EventType.Meeting: 4>, <EventType.SpecialCause: 5>, <EventType.MusicAndArts: 6>, <EventType.Sports: 7>, <EventType.Trip: 8>]] = None, starts_at: datetime.datetime | None = None) None
- await edit(name: str, content: str, *, type: ~typing.Literal[<EventType.Game: 2>] = None, starts_at: datetime.datetime | None = None, game: ~steam.game.Game, server_address: str | None = None, server_password: str | None = None) None
Edit the event’s details.
Note
If parameters are omitted they use what they are currently set to.
- Parameters:
name – The event’s name.
content – The event’s content.
type – The event’s type.
game – The event’s game.
starts_at – The event’s start time.
server_address – The event’s server’s address.
server_password – The event’s server’s password.
- Return type:
- await delete()¶
Delete this event.
- await comment(content, *, subscribe=True)¶
Post a comment to a comments section.
- Parameters:
- Returns:
The created comment.
- Return type:
- async for ... in comments(*, oldest_first=False, limit=None, before=None, after=None)¶
An
AsyncIteratorfor accessing a comment section’sCommentobjects.Examples
Usage:
async for comment in commentable.comments(limit=10): print("Author:", comment.author, "Said:", comment.content)
Flattening into a list:
comments = await commentable.comments(limit=50).flatten() # comments is now a list of Comment
All parameters are optional.
- Parameters:
oldest_first (bool) – Whether or not to request comments with the oldest comments first or last. Defaults to
False.limit (Optional[int]) – The maximum number of comments to search through. Default is
Nonewhich will fetch the all the comments in the comments section.before (Optional[datetime]) – A time to search for comments before.
after (Optional[datetime]) – A time to search for comments after.
- Yields:
Game Servers¶
- defis_dedicated
- defis_secure
- defis_valid
- asyncplayers
- asyncrules
- class steam.GameServer¶
Represents a game server.
- game¶
The game of the server.
- Type:
- region¶
The region the server is in.
- await players(*, challenge=0)¶
Fetch a server’s players.
- Parameters:
challenge (Literal[-1, 0]) –
The challenge for the request default is 0 can also be -1. You may need to change if the server doesn’t seem to respond.
Deprecated since version 0.9.0: This parameter no longer does anything.
- Returns:
ServerPlayer is a
typing.NamedTupledefined as: .. source:: steam.ServerPlayer- Return type:
- await rules(*, challenge=0)¶
Fetch a console variables. e.g.
sv_gravityorsv_voiceenable.
- staticmethod await from_url(url, session=None)¶
A helper function creates a SteamID instance from a Steam community url.
Note
See
id64_from_url()for the full parameter list.- Return type:
- property id: ID32¶
The SteamID’s 32-bit ID.
- property id2_zero: str¶
The SteamID’s ID 2 accounted for bugged GoldSrc and Orange Box games.
Note
In these games the accounts
universe,1forType.Public, should be theXcomponent ofSTEAM_X:0:1234however, this was bugged and the value ofXwas0.e.g
STEAM_0:0:1234.
- property id64: ID64¶
The SteamID’s 64-bit ID.
- property instance: InstanceFlag¶
The instance of the SteamID.
- clsQuery.all
- clsQuery.dedicated
- clsQuery.empty
- clsQuery.ip
- clsQuery.linux
- clsQuery.match_any_hidden_tags
- clsQuery.match_hidden_tags
- clsQuery.match_tags
- clsQuery.name_match
- clsQuery.no_password
- clsQuery.not_empty
- clsQuery.not_full
- clsQuery.not_running
- clsQuery.proxy
- clsQuery.region
- clsQuery.running
- clsQuery.running_map
- clsQuery.running_mod
- clsQuery.secure
- clsQuery.unique_addresses
- clsQuery.version_match
- clsQuery.whitelisted
- class steam.Query¶
A
pathlib.Pathlike class for constructing Global Master Server queries.- x == y
Checks if two queries are equal, order is checked.
- x / y
Appends y’s query to x.
- x | y
Combines the two queries in
\nor\[x\y](not or).
- x & y
Combines the two queries in
\nand\[x\y](not and).
Examples
Match games running TF2, that are not empty and are using VAC
>>> Query.running / TF2 / Query.not_empty / Query.secure <Query query='\\appid\\440\\empty\\1\\secure\\1'>
Matches games that are not empty, not full and are not using VAC
>>> Query.not_empty / Query.not_full | Query.secure <Query query='\\empty\\1\\nor\\[\\full\\1\\secure\\1]'>
Match games where the server name is not “A cool Server” or the server doesn’t support alltalk or increased max players
>>> Query.name_match / "A not cool server" | Query.match_tags / ["alltalk", "increased_maxplayers"] <Query query='\\nor\\[\\name_match\\A not cool server\\gametype\\[alltalk,increased_maxplayers]]'>
Match games where the server is not on linux and the server doesn’t have no password (has a password)
>>> Query.linux & Query.no_password
- class property all: QueryAll¶
Fetches any servers. Any operations on this will fail.
- class property dedicated: Q¶
Fetches servers that are running dedicated.
- class property empty: Q¶
Fetches servers that are empty.
- class property ip: Query[str]¶
Fetches servers on the specified IP address, port is optional.
See also
- class property linux: Q¶
Fetches servers running on a Linux platform.
Fetches servers with any of the given tag(s) in their ‘hidden’ tags only applies for
steam.LFD2.
Fetches servers with all the given tag(s) in their ‘hidden’ tags only applies for
steam.LFD2.
- class property match_tags: Query[list[str]]¶
Fetches servers with all the given tag(s) in
GameServer.tags.
- class property name_match: Query[str]¶
Fetches servers with their hostname matching “x” (
"*"is wildcard).
- class property no_password: Q¶
Fetches servers that are not password protected.
- class property not_empty: Q¶
Fetches servers that are not empty.
- class property not_full: Q¶
Fetches servers that are not full.
- class property proxy: Q¶
Fetches servers that are spectator proxies.
- class property region: Query[GameServerRegion]¶
Fetches servers in a given region.
- class property running_mod: Query[str]¶
Fetches servers running the specified modification (e.g. cstrike).
- class property secure: Q¶
Fetches servers that are using anti-cheat technology (VAC, but potentially others as well).
- class property unique_addresses: Q¶
Fetches only one server for each unique IP address matched.
- class property whitelisted: Q¶
Fetches servers that are whitelisted.
Group¶
- asyncchunk
- defget_channel
- defget_member
- defget_role
- asyncinvite
- defis_valid
- asyncjoin
- asyncleave
- asyncsearch
- class steam.Group¶
Represents a Steam group.
- await chunk()¶
Get a list of all members in the group.
- Return type:
Sequence[steam.user.GroupMember]
- property default_channel: ChatT¶
The group’s default channel.
- staticmethod await from_url(url, session=None)¶
A helper function creates a SteamID instance from a Steam community url.
Note
See
id64_from_url()for the full parameter list.- Return type:
- get_channel(id)¶
Get a channel from cache.
- Parameters:
id (int) – The ID of the channel.
- Return type:
ChatT | None
- get_member(id64)¶
Get a member of the chat group by id.
- Parameters:
id64 (ID64) – The 64 bit ID of the member to get.
- Return type:
MemberT | None
- get_role(id)¶
Get a role from cache.
- property id: ID32¶
The SteamID’s 32-bit ID.
- property id2_zero: str¶
The SteamID’s ID 2 accounted for bugged GoldSrc and Orange Box games.
Note
In these games the accounts
universe,1forType.Public, should be theXcomponent ofSTEAM_X:0:1234however, this was bugged and the value ofXwas0.e.g
STEAM_0:0:1234.
- property id64: ID64¶
The SteamID’s 64-bit ID.
- property instance: InstanceFlag¶
The instance of the SteamID.
- await invite(user)¶
Invites a
Userto the chat group.- Parameters:
user (User) – The user to invite to the chat group.
- property invite_code: str | None¶
The SteamID’s invite code in the s.team invite code format.
e.g.
cv-dgb.
- await join(*, invite_code=None)¶
Joins the chat group.
- await leave()¶
Leaves the chat group.
- property me: MemberT¶
The client user’s account in this chat group.
- await search(name)¶
Search for members in the chat group.
Invite¶
- class steam.UserInvite¶
Represents a invite from a user to become their friend.
- invitee¶
The user who sent the invite.
- Type:
Union[steam.user.User, steam.abc.SteamID]
- relationship¶
The relationship you have with the invitee.
- Type:
Optional[steam.enums.FriendRelationship]
- await accept()¶
Accept the invite request.
- await decline()¶
Decline the invite request.
- class steam.ClanInvite¶
Represents a invite to join a
Clanfrom a user.- clan¶
The clan to join.
- Type:
Union[steam.Clan, steam.abc.SteamID]
- invitee¶
The user who sent the invite.
- Type:
Union[steam.user.User, steam.abc.SteamID]
- relationship¶
The relationship you have with the clan.
- Type:
Optional[steam.enums.FriendRelationship]
- await accept()¶
Accept the invite request.
- await decline()¶
Decline the invite request.
Manifests¶
- class steam.Manifest¶
Represents a manifest which is a collection of files included with a depot build on Steam’s CDN.
- x == y
Checks if two manifests are equal.
- len(x)
Returns the number of files this manifest holds.
- game¶
The game that this manifest was fetched from.
- Type:
- created_at¶
The time at which the depot was created at.
- Type:
- property paths: Sequence[ManifestPath]¶
The depot’s files.
- defas_posix
- defas_uri
- defglob
- asyncimage
- defis_absolute
- defis_dir
- defis_executable
- defis_file
- defis_hidden
- defis_relative_to
- defis_reserved
- defis_symlink
- defiterdir
- defjoinpath
- defmatch
- async withopen
- asyncread
- asyncread_bytes
- asyncread_text
- asyncread_vdf
- defreadlink
- defrelative_to
- defrglob
- asyncsave
- defwith_name
- defwith_stem
- defwith_suffix
- class steam.ManifestPath¶
A
pathlib.PurePathsubclass representing a binary file in a Manifest. This class is broadly compatible withpathlib.Path.- x == y
Checks if two paths are equal.
- hash(x)
Hashes this path.
- x < y
Checks if one path is less than the other.
- property parents: ManifestPathParents¶
A sequence of this path’s logical parents.
- property chunks: Sequence[PayloadFileMappingChunkData]¶
A read-only version of this path’s chunks instances.
- flags¶
This path’s flags.
Whether this file is hidden.
- Return type:
- readlink()¶
If this path is a symlink where it points to. Similar to
pathlib.Path.readlink()- Raises:
OSError – this path isn’t a symlink.
- Return type:
Self
- for ... in iterdir()¶
Iterate over this path. Similar to
pathlib.Path.iterdir().- Return type:
- for ... in glob(pattern)¶
Perform a glob operation on this path. Similar to
pathlib.Path.glob().- Return type:
- for ... in rglob(pattern)¶
Perform a recursive glob operation on this path. Similar to
pathlib.Path.rglob().- Return type:
- async with open()¶
Reads the entire contents of the file into a
io.BytesIOobject.- Raises:
IsADirectoryError – This path is a directory and cannot be opened.
RuntimeError – The depot cannot be decrypted as no key for its manifest was found.
- Return type:
contextlib._AsyncGeneratorContextManager[_io.BytesIO]
- await read_bytes(**kwargs)¶
Read the contents of the file. Similar to
pathlib.Path.read_bytes()- Return type:
- await read()¶
Read the whole contents of this file.
- Return type:
Never
- await read_text(encoding=None)¶
Read the contents of the file. Similar to
pathlib.Path.read_text()- Return type:
- await read_vdf(encoding=None)¶
Read the contents of the file into a VDFDict.
- property anchor¶
The concatenation of the drive and root, or ‘’.
- as_posix()¶
Return the string representation of the path with forward (/) slashes.
- as_uri()¶
Return the path as a ‘file’ URI.
- property drive¶
The drive prefix (letter or UNC path), if any.
- await image(*, spoiler=False, **kwargs)¶
Return this file as an image for uploading.
- Return type:
- is_absolute()¶
True if the path is absolute (has both a root and, if applicable, a drive).
- is_relative_to(*other)¶
Return True if the path is relative to another path or False.
- is_reserved()¶
Return True if the path contains one of the special names reserved by the system, if any.
- joinpath(*args)¶
Combine this path with one or several arguments, and return a new path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored).
- match(path_pattern)¶
Return True if this path matches the given pattern.
- property name¶
The final path component, if any.
- property parent¶
The logical parent of the path.
- property parts¶
An object providing sequence-like access to the components in the filesystem path.
- relative_to(*other)¶
Return the relative path to another path identified by the passed arguments. If the operation is not possible (because this is not a subpath of the other path), raise ValueError.
- property root¶
The root of the path, if any.
- await save(filename, **kwargs)¶
Save the file to a path.
- Parameters:
filename (StrOrBytesPath) – The filename of the file to be created and have this saved to.
- Returns:
The number of bytes written.
- Return type:
- property stem¶
The final path component, minus its last suffix.
- property suffix¶
The final component’s last suffix, if any.
This includes the leading period. For example: ‘.txt’
- property suffixes¶
A list of the final component’s suffixes, if any.
These include the leading periods. For example: [‘.tar’, ‘.gz’]
- with_name(name)¶
Return a new path with the file name changed.
- with_stem(stem)¶
Return a new path with the stem changed.
- with_suffix(suffix)¶
Return a new path with the file suffix changed. If the path has no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path.
- asyncfetch_manifests
- class steam.Branch¶
Represents a branch on for a Steam app. Branches are specific builds of an application that have made available publicly or privately through Steam.
Read more on steamworks.
- build_id¶
The branch’s build ID. This is a globally incrementing number. Build IDs are updated when a new build of an application is pushed.
- Type:
- updated_at¶
The time this branch was last updated. This can be
Noneif the branch is ancient and hasn’t been updated in ages.- Type:
Optional[datetime.datetime]
- depots¶
This branch’s depots.
- Type:
- property manifests: list[steam.manifest.ManifestInfo]¶
This branch’s manifests.
- await fetch_manifests()¶
Fetch this branch’s manifests. Similar to
StatefulGame.manifests().- Return type:
- class steam.ManifestInfo¶
Represents information about a manifest.
- branch¶
The branch this manifest is for.
- Type:
- depot¶
The depot this manifest is for.
- Type:
- class steam.HeadlessDepot¶
Represents a depot without a branch.
- class steam.Depot¶
Represents a depot which is a grouping of files.
Read more on steamworks.
- manifest: ManifestInfo¶
- branches
- change_number
- community_hub_visible
- controller_support
- created_at
- developers
- has_adult_content
- has_adult_content_violence
- headless_depots
- icon_url
- logo_url
- market_presence
- partial_dlc
- public_branch
- publishers
- review_percentage
- review_score
- sha
- size
- supported_languages
- title
- type
- url
- website_url
- workshop_visible
- asyncadd_free_licenses
- asyncclan
- asyncdlc
- asyncfetch
- asyncfetch_manifest
- asyncfriend_thoughts
- asyncfriends_who_own
- defget_branch
- defhas_visible_stats
- asyncinfo
- defis_free
- defis_on_linux
- defis_on_mac_os
- defis_on_windows
- defis_steam_game
- async formanifests
- asyncpackages
- asyncplayer_count
- async forpublished_files
- asyncreview
- async forreviews
- class steam.GameInfo¶
Represents a collection of information on a game.
- type¶
The game’s type.
- controller_support¶
This game’s level of controller support.
- Type:
Union[Literal[‘full’], Literal[‘partial’], Literal[‘none’]]
- supported_languages¶
This game’s supported languages.
- Type:
- created_at¶
The time this game was created.
- Type:
Optional[datetime.datetime]
- review_score¶
This game’s review score.
- partial_dlc¶
This game’s downloadable content.
- Type:
- headless_depots¶
The depots for this game without a branch.
- Type:
Sequence[steam.HeadlessDepot]
- get_branch(name)¶
Get a branch by its name.
- Return type:
- await add_free_licenses()¶
Request the free licenses for this game.
- Raises:
ValueError – No licenses were granted.
- Return type:
- await clan()¶
Fetch this game’s clan.
This can be useful to get a Game’s updates.
clan = await game.clan() async for update in clan.announcements().filter( lambda announcement: announcement.type in (steam.ClanEvent.MajorUpdate, steam.ClanEvent.SmallUpdate) ): ... # do something with the update
- Raises:
ValueError – This game has no associated clan.
- Return type:
- await dlc(*, language=None)¶
Fetch the game’s DLC.
- await fetch(*, language=None)¶
Shorthand for:
game = await client.fetch_game(game)
- Return type:
- await fetch_manifest(*, id, depot_id, branch='public', password_hash='')¶
Fetch a CDN manifest for a game.
- await friend_thoughts()¶
Fetch the client user’s friends who recommended and didn’t recommend this game in a review.
- Return type:
FriendThoughts
- await friends_who_own()¶
Fetch the users in your friend list who own this game.
- await info()¶
Shorthand for:
(info,) = await client.fetch_product_info(games=[game])
- Return type:
- async for ... in manifests(*, limit=100, before=None, after=None, branch='public', password=None, password_hash='')¶
An
AsyncIteratorfor accessing asteam.Game’ssteam.Manifests.Examples
Usage:
async for manifest in game.manifests(limit=10): print("Manifest:", manifest.name) print(f"Contains {len(manifest.paths)} manifests")
Flattening into a list:
manifests = await game.manifests(limit=50).flatten() # manifests is now a list of Manifest
All parameters are optional.
- Parameters:
limit (int | None) – The maximum number of
Manifeststo return.before (Optional[datetime]) – The time to get manifests before.
after (Optional[datetime]) – The time to get manifests after.
branch (str) – The name of the branch to fetch manifests from.
password (Optional[str]) – The password for the branch, if any.
password_hash (str) – The hashed password for a manifest.
- Yields:
- await packages(*, language=None)¶
Fetch the game’s packages.
- Parameters:
language (Language | None) – The language to fetch the packages in. If
None, the current language will be used.- Return type:
- async for ... in published_files(*, type=PublishedFileQueryFileType.Items, revision=PublishedFileRevision.Default, language=None, limit=100, before=None, after=None)¶
An
AsyncIteratorfor accessing a game’ssteam.PublishedFiles.Examples
Usage:
async for published_file in game.published_files(limit=10): print("Published file:", published_file.name) print("Published at:", published_file.created_at) print("Published by:", published_file.author)
Flattening into a list:
published_files = await game.published_files(limit=50).flatten() # published_files is now a list of PublishedFile
All parameters are optional.
- Parameters:
type (PublishedFileQueryFileType) – The type of published files to fetch.
revision (PublishedFileRevision) – The desired revision of the published files to fetch.
language (Optional[Language]) – The language to fetch the published files in. If
Nonethe current language is used.limit (int | None) – The maximum number of published files to search through. Default is
100. Setting this toNonewill fetch all the game’s published files, but this will be a very slow operation.before (Optional[datetime]) – A time to search for published files before.
after (Optional[datetime]) – A time to search for published files after.
- Yields:
- await review(content, *, recommend, public=True, commentable=True, received_compensation=False, language=None)¶
Review a game.
- Parameters:
content (str) – The content of the review.
recommend (bool) – Whether you recommended the game.
public (bool) – Whether the review should be public.
commentable (bool) – Whether the review should allow comments.
received_compensation (bool) – Whether you received compensation for this review.
language (Language | None) – The language the review is in.
- Return type:
- async for ... in reviews(*, limit=100, before=None, after=None)¶
An
AsyncIteratorfor accessing asteam.Game’ssteam.Reviews.Examples
Usage:
async for review in game.reviews(limit=10): print("Reviewer:", review.author) print("Said:", review.content)
Flattening into a list:
reviews = await game.reviews(limit=50).flatten() # reviews is now a list of Review
All parameters are optional.
- Parameters:
limit (int | None) – The maximum number of reviews to search through. Default is
100. Setting this toNonewill fetch all the game’s reviews, but this will be a very slow operation.before (Optional[datetime]) – A time to search for reviews before.
after (Optional[datetime]) – A time to search for reviews after.
- Yields:
- asyncdepots
- asyncfetch
- asyncgames
- asyncgames_info
- asyncinfo
- class steam.PackageInfo¶
Represents a collection of information on a package.
- games¶
The games included in the package.
- billing_type¶
The billing type for the package.
- license_type¶
The license type for the package.
- status¶
The status for the package.
- await depots()¶
Fetches this package’s depots.
- Return type:
Sequence[Depot | HeadlessDepot]
- await fetch()¶
Fetches this package’s information. Shorthand for:
package = await client.fetch_package(package)
- Return type:
- await games_info()¶
Shorthand for:
infos = await client.fetch_product_info(games=await package.games())
- await info()¶
Shorthand for:
(info,) = await client.fetch_product_info(packages=[package])
- Return type:
- await games()¶
Fetches this package’s games.
- Return type:
Message¶
- asyncadd_emoticon
- asyncadd_sticker
- asyncremove_emoticon
- asyncremove_sticker
- class steam.Message¶
Represents a message from a
User. This is a base class from which all messages inherit.The following classes implement this:
- x == y
Checks if two messages are equal
- hash(x)
Returns the hash of a message.
- author: Union[User, ClientUser, SteamID]¶
The message’s author.
- group: Optional[Group]¶
The group the message was sent in. Will be
Noneif the message wasn’t sent in aGroup.
- clan: Optional[Clan]¶
The clan the message was sent in. Will be
Noneif the message wasn’t sent in aClan.
- content: str¶
The message’s content.
Note
This is not what you will see in the steam client see
clean_contentfor that.
- ordinal: int¶
A per-channel incremented integer up to
1000for every message sent in a second window.
- reactions: list[steam.reaction.MessageReaction]¶
The reactions this message has received.
- id¶
A unique identifier for every message sent in a channel.
Note
This is not something Steam provides, this is meant to be a simple way to compare messages.
- abstractmethod await add_emoticon(emoticon)¶
Adds an emoticon to this message.
- Parameters:
emoticon (Emoticon) – The emoticon to add to this message.
- abstractmethod await remove_emoticon(emoticon)¶
Removes an emoticon from this message.
- Parameters:
emoticon (Emoticon) – The emoticon to remove from this message.
- asyncadd_emoticon
- asyncadd_sticker
- asyncremove_emoticon
- asyncremove_sticker
- class steam.UserMessage¶
Represents a message from a user.
- author: Union[User, ClientUser, SteamID]¶
The message’s author.
- await add_emoticon(emoticon)¶
Adds an emoticon to this message.
- Parameters:
emoticon (Emoticon) – The emoticon to add to this message.
- await remove_emoticon(emoticon)¶
Removes an emoticon from this message.
- await add_sticker(sticker)¶
Adds a sticker to this message.
- await remove_sticker(sticker)¶
Adds a sticker to this message.
- content: str¶
The message’s content.
Note
This is not what you will see in the steam client see
clean_contentfor that.
- ordinal: int¶
A per-channel incremented integer up to
1000for every message sent in a second window.
- group: Optional[Group]¶
The group the message was sent in. Will be
Noneif the message wasn’t sent in aGroup.
- clan: Optional[Clan]¶
The clan the message was sent in. Will be
Noneif the message wasn’t sent in aClan.
- reactions: list[steam.reaction.MessageReaction]¶
The reactions this message has received.
- id¶
A unique identifier for every message sent in a channel.
Note
This is not something Steam provides, this is meant to be a simple way to compare messages.
- asyncadd_emoticon
- asyncadd_sticker
- asyncfetch_reaction
- asyncfetch_reactions
- asyncremove_emoticon
- asyncremove_sticker
- class steam.GroupMessage¶
Represents a message in a group.
- group: Optional[Group]¶
The group the message was sent in. Will be
Noneif the message wasn’t sent in aGroup.
- clan: Optional[Clan]¶
The clan the message was sent in. Will be
Noneif the message wasn’t sent in aClan.
- author: Union[User, ClientUser, SteamID]¶
The message’s author.
- content: str¶
The message’s content.
Note
This is not what you will see in the steam client see
clean_contentfor that.
- ordinal: int¶
A per-channel incremented integer up to
1000for every message sent in a second window.
- reactions: list[steam.reaction.MessageReaction]¶
The reactions this message has received.
- await add_emoticon(emoticon)¶
Adds an emoticon to this message.
- Parameters:
emoticon (Emoticon) – The emoticon to add to this message.
- await add_sticker(sticker)¶
Adds a sticker to this message.
- Parameters:
sticker (Sticker) – The sticker to add to this message.
- await fetch_reaction(emoticon)¶
Fetches the reactions to this message with a given emoticon.
- Return type:
- await fetch_reactions()¶
Fetches all this message’s reactions.
Warning
This does nothing for messages that aren’t fetched by
GroupChannel.history()/ClanChannel.history().- Return type:
- id¶
A unique identifier for every message sent in a channel.
Note
This is not something Steam provides, this is meant to be a simple way to compare messages.
- asyncadd_emoticon
- asyncadd_sticker
- asyncfetch_reaction
- asyncfetch_reactions
- asyncremove_emoticon
- asyncremove_sticker
- class steam.ClanMessage¶
Represents a message in a clan.
- clan: Optional[Clan]¶
The clan the message was sent in. Will be
Noneif the message wasn’t sent in aClan.
- group: Optional[Group]¶
The group the message was sent in. Will be
Noneif the message wasn’t sent in aGroup.
- author: Union[User, ClientUser, SteamID]¶
The message’s author.
- content: str¶
The message’s content.
Note
This is not what you will see in the steam client see
clean_contentfor that.
- ordinal: int¶
A per-channel incremented integer up to
1000for every message sent in a second window.
- reactions: list[steam.reaction.MessageReaction]¶
The reactions this message has received.
- await add_emoticon(emoticon)¶
Adds an emoticon to this message.
- Parameters:
emoticon (Emoticon) – The emoticon to add to this message.
- await add_sticker(sticker)¶
Adds a sticker to this message.
- Parameters:
sticker (Sticker) – The sticker to add to this message.
- await fetch_reaction(emoticon)¶
Fetches the reactions to this message with a given emoticon.
- Return type:
- await fetch_reactions()¶
Fetches all this message’s reactions.
Warning
This does nothing for messages that aren’t fetched by
GroupChannel.history()/ClanChannel.history().- Return type:
- id¶
A unique identifier for every message sent in a channel.
Note
This is not something Steam provides, this is meant to be a simple way to compare messages.
Package¶
- class steam.Package¶
Represents information on a package which is a collection of one or more applications and depots.
Read more on steamworks.
- asyncdepots
- asyncfetch
- asyncgames
- asyncgames_info
- asyncinfo
- class steam.package.StatefulPackage¶
A package with state.
- await depots()¶
Fetches this package’s depots.
- Return type:
- await fetch()¶
Fetches this package’s information. Shorthand for:
package = await client.fetch_package(package)
- Return type:
- await games()¶
Fetches this package’s games.
- Return type:
- await games_info()¶
Shorthand for:
infos = await client.fetch_product_info(games=await package.games())
- Return type:
- await info()¶
Shorthand for:
(info,) = await client.fetch_product_info(packages=[package])
- Return type:
- asyncdepots
- asyncfetch
- asyncgames
- asyncgames_info
- asyncinfo
- defis_free
- defis_on_linux
- defis_on_mac_os
- defis_on_windows
- class steam.FetchedPackage¶
- await depots()¶
Fetches this package’s depots.
- Return type:
- await fetch()¶
Fetches this package’s information. Shorthand for:
package = await client.fetch_package(package)
- Return type:
- await games()¶
Fetches this package’s games.
- Return type:
- await games_info()¶
Shorthand for:
infos = await client.fetch_product_info(games=await package.games())
- Return type:
- await info()¶
Shorthand for:
(info,) = await client.fetch_product_info(packages=[package])
- Return type:
- asyncdepots
- asyncfetch
- asyncgames
- asyncgames_info
- asyncinfo
- class steam.License¶
Represents a License to a package the client user has access to.
- owner: Union[User, ClientUser, SteamID]¶
- type¶
- flags¶
- master_package: Optional[StatefulPackage]¶
- await depots()¶
Fetches this package’s depots.
- Return type:
- await fetch()¶
Fetches this package’s information. Shorthand for:
package = await client.fetch_package(package)
- Return type:
- await games()¶
Fetches this package’s games.
- Return type:
- await games_info()¶
Shorthand for:
infos = await client.fetch_product_info(games=await package.games())
- Return type:
- await info()¶
Shorthand for:
(info,) = await client.fetch_product_info(packages=[package])
- Return type:
- payment_method¶
- property time_remaining: datetime.timedelta | None¶
The amount of time that this license can be used for.
- asyncdepots
- asyncfetch
- asyncgames
- asyncgames_info
- asyncinfo
- class steam.FetchedGamePackage¶
- await depots()¶
Fetches this package’s depots.
- Return type:
- await fetch()¶
Fetches this package’s information. Shorthand for:
package = await client.fetch_package(package)
- Return type:
- await games()¶
Fetches this package’s games.
- Return type:
- await games_info()¶
Shorthand for:
infos = await client.fetch_product_info(games=await package.games())
- Return type:
- await info()¶
Shorthand for:
(info,) = await client.fetch_product_info(packages=[package])
- Return type:
PriceOverview¶
- class steam.PriceOverview¶
Represents the data received from https://steamcommunity.com/market/priceoverview.
Profile¶
- class steam.ProfileInfo¶
Represents the user’s profile info.
- class steam.ProfileItem¶
Represents an item on/in a user’s profile.
- game: StatefulGame¶
- type¶
- class_¶
- movie: ProfileMovie¶
- await equip()¶
Equip the profile item.
- await item(*, language=None)¶
Resolve this to an actual item in the owner’s inventory.
- Return type:
- class steam.OwnedProfileItems¶
Represents the
ClientUser's owned items.- backgrounds: list[steam.ProfileItem]¶
- mini_profile_backgrounds: list[steam.ProfileItem]¶
- avatar_frames: list[steam.ProfileItem]¶
- animated_avatars: list[steam.ProfileItem]¶
- modifiers: list[steam.ProfileItem]¶
- class steam.EquippedProfileItems¶
Represents the items the user has equipped.
- background: Optional[ProfileItem]¶
- mini_profile_background: Optional[ProfileItem]¶
- avatar_frame: Optional[ProfileItem]¶
- animated_avatar: Optional[ProfileItem]¶
- modifier: Optional[ProfileItem]¶
- asyncbadges
- asyncitems
- asyncpublished_file
- class steam.ProfileShowcase¶
ProfileShowcase(_state: ‘ConnectionState’, owner: ‘BaseUser’, type: ‘ProfileItemType’, large: ‘bool’, active: ‘bool’, purchase_id: ‘int’, level: ‘int’, style: ‘ProfileCustomisationStyle’, slots: ‘list[ProfileShowcaseSlot]’)
- type: ProfileItemType¶
- style: ProfileCustomisationStyle¶
- await items(*, language)¶
Fetches the associated :class:`.Item`s for the entire showcase.
- Parameters:
language (steam.enums.Language | None) – The language to fetch the items in. If
None, the current language is used.- Return type:
- await published_file(*, revision=PublishedFileRevision.Default, language=None)¶
Fetches the associated
PublishedFilefrompublished_file_id.- Parameters:
revision (PublishedFileRevision) – The revision of the file to fetch.
language (Language | None) – The language to fetch the file in. If
None, the current language is used.
- Return type:
- class steam.Profile¶
Represents a user’s complete profile.
PublishedFile¶
- accepted
- author
- available_revisions
- ban_reason
- ban_text_check_result
- banned
- banner
- can_be_deleted
- can_subscribe
- cdn_url
- change_number
- children
- consumer_shortcut_id
- created_at
- created_with
- description
- downvotes
- favourited
- filename
- flags
- followers
- for_sale_data
- game
- id
- image_height
- image_url
- image_width
- incompatible
- kv_tags
- language
- lifetime_favourited
- lifetime_followers
- lifetime_playtime
- lifetime_playtime_sessions
- lifetime_subscriptions
- manifest_id
- maybe_inappropriate_sex
- maybe_inappropriate_violence
- metadata
- name
- number_of_developer_comments
- number_of_public_comments
- playtime_stats
- preview
- previews
- reactions
- reports
- revision
- score
- shortcut_id
- shortcut_name
- show_subscribe_all
- size
- spoiler
- subscriptions
- tags
- time_subscribed
- type
- updated_at
- upvotes
- url
- views
- visibility
- youtube_id
- asyncadd_child
- asyncaward
- asynccomment
- async forcomments
- asyncdownvote
- asyncedit
- asyncfetch_children
- asyncfetch_comment
- asyncfetch_history_entry
- asynchistory
- asyncis_subscribed
- asyncmanifest
- asyncparents
- asyncremove_child
- asyncsubscribe
- asyncunsubscribe
- asyncupvote
- class steam.PublishedFile(state, proto, author)¶
Represents a published file on SteamPipe.
- author: Union[User, ClientUser, SteamID]¶
- game: StatefulGame¶
- created_with: StatefulGame¶
- revision¶
- type¶
- visibility¶
- preview: PreviewInfo¶
- ban_text_check_result: EBanContentCheckResult¶
- await award(award)¶
Add an
Awardto this piece of user generated content.- Parameters:
award (Award) – The award to add.
- await comment(content, *, subscribe=True)¶
Post a comment to a comments section.
- Parameters:
- Returns:
The created comment.
- Return type:
- async for ... in comments(*, oldest_first=False, limit=None, before=None, after=None)¶
An
AsyncIteratorfor accessing a comment section’sCommentobjects.Examples
Usage:
async for comment in commentable.comments(limit=10): print("Author:", comment.author, "Said:", comment.content)
Flattening into a list:
comments = await commentable.comments(limit=50).flatten() # comments is now a list of Comment
All parameters are optional.
- Parameters:
oldest_first (bool) – Whether or not to request comments with the oldest comments first or last. Defaults to
False.limit (Optional[int]) – The maximum number of comments to search through. Default is
Nonewhich will fetch the all the comments in the comments section.before (Optional[datetime]) – A time to search for comments before.
after (Optional[datetime]) – A time to search for comments after.
- Yields:
- await fetch_comment(id)¶
Fetch a comment by its ID.
- Parameters:
id (int) – The ID of the comment to fetch.
- Return type:
- playtime_stats: PublishedFileDetailsPlaytimeStats¶
- for_sale_data: PublishedFileDetailsForSaleData¶
- language¶
- reactions: list[steam.reaction.AwardReaction]¶
- await manifest()¶
The manifest associated with this published file.
- Return type:
- await fetch_children(*, revision=PublishedFileRevision.Default, language=None)¶
Fetches this published file’s children.
- Parameters:
revision (PublishedFileRevision) – The revision to fetch.
language (Optional[Language]) – The language to fetch children in. If
None, the current language is used.
- Return type:
- await parents(*, revision=PublishedFileRevision.Default, language=None)¶
Fetches this published file’s parents.
- Parameters:
revision (PublishedFileRevision) – The revision to fetch.
language (Optional[Language]) – The language to fetch parents in. If
None, the current language is used.
- Return type:
- await upvote()¶
Upvotes this published file.
- await downvote()¶
Downvotes this published file.
- await subscribe()¶
Subscribes to this published file’s changes.
- await unsubscribe()¶
Unsubscribes from this published file’s changes.
- await is_subscribed()¶
Whether the client user is subscribed to this published file.
- Return type:
- await add_child(child)¶
Adds a child to this published file.
- Parameters:
child (PublishedFile) – The child to add.
- await remove_child(child)¶
Removes a child from this published file.
- Parameters:
child (PublishedFile) – The child to remove.
- await history(*, language=None)¶
Fetches this published file’s history.
- await fetch_history_entry(at, *, language=None)¶
Fetches the history entry at a given time.
- await edit(*, name=None, description=None, visibility=None, tags=(), filename=None, preview_filename=None)¶
Edits this published file.
Trading¶
- defis_marketable
- defis_tradable
- class steam.Item¶
Represents an item in a User’s inventory.
- x == y
Checks if two items are equal.
- display_name¶
The displayed name of the item. This could be different to
Item.nameif the item is user re-nameable.- Type:
Optional[str]
- owner_descriptions¶
The descriptions of the item which are visible only to the owner of the item.
- Type:
- game¶
The game the item is from.
- property url: str¶
The URL for the asset in the owner’s inventory.
e.g. https://steamcommunity.com/profiles/76561198248053954/inventory/#440_2_8526584188
- class steam.Asset¶
Base most version of an item. This class should only be received when Steam fails to find a matching item for its class and instance IDs.
- x == y
Checks if two assets are equal.
- hash(x)
Returns the hash of an asset.
- post_rollback_id¶
The assetid of the item after a rollback (cancelled, etc.).
Noneif not rolled back.
- owner¶
The owner of the asset
- Type:
- game¶
The game the item is from.
- property url: str¶
The URL for the asset in the owner’s inventory.
e.g. https://steamcommunity.com/profiles/76561198248053954/inventory/#440_2_8526584188
Reactions¶
- class steam.Award¶
Represents an award.
- async with open(*, animated=False)¶
Open this file as and returns its contents as an in memory buffer.
- Return type:
contextlib._AsyncGeneratorContextManager[_io.BytesIO]
- await image(*, spoiler=False, **kwargs)¶
Return this file as an image for uploading.
- Return type:
- class steam.AwardReaction¶
Represents an award on user generated content.
- award¶
The award given to the user generated content.
- Type:
- class steam.PartialMessageReaction¶
Represents a partial reaction to a message.
- class steam.MessageReaction¶
Represents a reaction to a message.
- user: Union[User, ClientUser, SteamID]¶
- class steam.Emoticon¶
Represents an emoticon in chat.
- str(x)
The string to send this emoticon in chat.
- await game()¶
Fetches this emoticon’s associated game.
Note
This game has its
nameset unlikeSticker.game().- Return type:
- await image(*, spoiler=False, **kwargs)¶
Return this file as an image for uploading.
- Return type:
- async with open(**kwargs)¶
Open this file as and returns its contents as an in memory buffer.
- Return type:
AsyncGenerator[BytesIO, None]
- class steam.Sticker¶
Represents a sticker in chat.
- str(x)
The way to send this sticker in chat.
Note
Unlike
Emoticonthis can only be sent in a message by itself.- await game()¶
Fetches this sticker’s associated game.
- Return type:
- await image(*, spoiler=False, **kwargs)¶
Return this file as an image for uploading.
- Return type:
- async with open(**kwargs)¶
Open this file as and returns its contents as an in memory buffer.
- Return type:
AsyncGenerator[BytesIO, None]
- class steam.ClientEmoticon¶
Represents an
EmoticontheClientUserowns.- await game()¶
Fetches this emoticon’s associated game.
Note
This game has its
nameset unlikeSticker.game().- Return type:
- await image(*, spoiler=False, **kwargs)¶
Return this file as an image for uploading.
- Return type:
- async with open(**kwargs)¶
Open this file as and returns its contents as an in memory buffer.
- Return type:
AsyncGenerator[BytesIO, None]
- await save(filename, **kwargs)¶
Save the file to a path.
- Parameters:
filename (StrOrBytesPath) – The filename of the file to be created and have this saved to.
- Returns:
The number of bytes written.
- Return type:
- class steam.ClientSticker¶
Represents a
StickertheClientUserowns.- await image(*, spoiler=False, **kwargs)¶
Return this file as an image for uploading.
- Return type:
- async with open(**kwargs)¶
Open this file as and returns its contents as an in memory buffer.
- Return type:
AsyncGenerator[BytesIO, None]
- await save(filename, **kwargs)¶
Save the file to a path.
- Parameters:
filename (StrOrBytesPath) – The filename of the file to be created and have this saved to.
- Returns:
The number of bytes written.
- Return type:
- await game()¶
Fetches this sticker’s associated game.
- Return type:
Reviews¶
- asyncaward
- asynccomment
- async forcomments
- asyncdelete
- asyncedit
- asyncfetch_comment
- asyncmark_funny
- asyncmark_helpful
- asyncmark_not_helpful
- class steam.Review¶
Represents a review for a game.
- author: ReviewUser¶
- game: ReviewGame¶
- await award(award)¶
Add an
Awardto this piece of user generated content.- Parameters:
award (Award) – The award to add.
- await comment(content, *, subscribe=True)¶
Post a comment to a comments section.
- Parameters:
- Returns:
The created comment.
- Return type:
- async for ... in comments(*, oldest_first=False, limit=None, before=None, after=None)¶
An
AsyncIteratorfor accessing a comment section’sCommentobjects.Examples
Usage:
async for comment in commentable.comments(limit=10): print("Author:", comment.author, "Said:", comment.content)
Flattening into a list:
comments = await commentable.comments(limit=50).flatten() # comments is now a list of Comment
All parameters are optional.
- Parameters:
oldest_first (bool) – Whether or not to request comments with the oldest comments first or last. Defaults to
False.limit (Optional[int]) – The maximum number of comments to search through. Default is
Nonewhich will fetch the all the comments in the comments section.before (Optional[datetime]) – A time to search for comments before.
after (Optional[datetime]) – A time to search for comments after.
- Yields:
- await fetch_comment(id)¶
Fetch a comment by its ID.
- Parameters:
id (int) – The ID of the comment to fetch.
- Return type:
- reactions: Optional[list[steam.AwardReaction]]¶
- await mark_helpful()¶
Mark this review as helpful.
- await mark_not_helpful()¶
Mark this review as not helpful.
- await mark_funny()¶
Mark this review as funny.
- await edit(content, *, public=True, commentable=None, language=None, written_during_early_access=None, received_compensation=None)¶
Edit this review.
- Parameters:
content (str) – The content of the review.
public (bool) – Whether the review should be shown publicly on your profile.
commentable (Optional[bool]) – Whether the review should be commentable.
language (Optional[Language]) – The language of the review. Defaults to the current value.
written_during_early_access (Optional[bool]) – Whether the review was written during early access. Defaults to the current value.
received_compensation (Optional[bool]) – Whether the user received compensation for this review. Defaults to the current value.
- await delete()¶
Delete this review.
Roles¶
- class steam.Role¶
Users¶
- asyncbadges
- asyncbans
- asyncclans
- asyncclear_nicks
- asynccomment
- async forcomments
- asyncedit
- asyncequipped_profile_items
- asyncfavourite_badge
- asyncfetch_comment
- asyncfetch_review
- asyncfetch_reviews
- asyncfriends
- asyncgames
- defget_friend
- asyncinventory
- asyncis_banned
- defis_commentable
- defis_private
- defis_valid
- asynclevel
- asyncprofile
- asyncprofile_customisation_info
- asyncprofile_info
- asyncprofile_items
- async forpublished_files
- async forreviews
- asyncsetup_profile
- asyncwishlist
- class steam.ClientUser¶
Represents your account.
- x == y
Checks if two users are equal.
- str(x)
Returns the user’s name.
- friends¶
A list of the
ClientUser’s friends.
- state¶
The current persona state of the account (e.g. LookingToTrade).
- Type:
Optional[steam.enums.PersonaState]
- game¶
The Game instance attached to the user. Is
Noneif the user isn’t in a game or one that is recognised by the api.- Type:
Optional[steam.StatefulGame]
- primary_clan¶
The user’s primary clan. Could be
None- Type:
Optional[steam.Clan]
- created_at¶
The time at which the user’s account was created. Could be
None.- Type:
Optional[datetime.datetime]
- last_logon¶
The last time the user logged into steam. This is only
Noneif user hasn’t been updated from the websocket.- Type:
Optional[datetime.datetime]
- last_logoff¶
The last time the user logged off from steam. Could be
None(e.g. if they are currently online).- Type:
Optional[datetime.datetime]
- last_seen_online¶
The last time the user could be seen online. This is only
Noneif user hasn’t been updated from the websocket.- Type:
Optional[datetime.datetime]
- flags¶
The persona state flags of the account.
- Type:
Optional[steam.enums.PersonaStateFlag]
- await friends()¶
Returns a list of the user’s friends.
- Return type:
- get_friend(id)¶
Get a friend from the client user’s friends list.
- Return type:
- await inventory(game, *, language=None)¶
Fetch a user’s
Inventoryfor trading.- Parameters:
- Raises:
Forbidden – The user’s inventory is private.
- Return type:
steam.trade.BaseInventory[steam.Item]
- await setup_profile()¶
Set up your profile if possible.
- await clear_nicks()¶
Clears the client user’s nickname/alias history.
- await profile_items(*, language=None)¶
Fetch all the client user’s profile items.
- await profile(*, language=None)¶
Fetch a user’s entire profile information.
- Parameters:
language (Optional[Language]) – The language to fetch the profile items in. If
Nonethe current language is used
Note
This calls all the profile related functions to return a Profile object which has all the info set.
- Return type:
steam.profile.ClientUserProfile
- await profile_info()¶
The friend’s profile info.
- Return type:
- await edit(*, name=None, real_name=None, url=None, summary=None, country=None, state=None, city=None, avatar=None)¶
Edit the client user’s profile. Any values that aren’t set will use their defaults.
- Parameters:
name (str | None) – The new name you wish to go by.
real_name (str | None) – The real name you wish to go by.
url (str | None) – The custom url ending/path you wish to use.
summary (str | None) – The summary/description you wish to use.
country (str | None) – The country you want to be from.
state (str | None) – The state you want to be from.
city (str | None) – The city you want to be from.
avatar (Image | None) –
The avatar you wish to use.
Note
This needs to be at least 184px x 184px.
- Raises:
HTTPException – Editing your profile failed.
- await badges()¶
Fetches the user’s
UserBadgess.- Return type:
- await comment(content, *, subscribe=True)¶
Post a comment to a comments section.
- Parameters:
- Returns:
The created comment.
- Return type:
- async for ... in comments(*, oldest_first=False, limit=None, before=None, after=None)¶
An
AsyncIteratorfor accessing a comment section’sCommentobjects.Examples
Usage:
async for comment in commentable.comments(limit=10): print("Author:", comment.author, "Said:", comment.content)
Flattening into a list:
comments = await commentable.comments(limit=50).flatten() # comments is now a list of Comment
All parameters are optional.
- Parameters:
oldest_first (bool) – Whether or not to request comments with the oldest comments first or last. Defaults to
False.limit (Optional[int]) – The maximum number of comments to search through. Default is
Nonewhich will fetch the all the comments in the comments section.before (Optional[datetime]) – A time to search for comments before.
after (Optional[datetime]) – A time to search for comments after.
- Yields:
- await equipped_profile_items(*, language=None)¶
The user’s equipped profile items.
- await favourite_badge()¶
The user’s favourite badge.
- Return type:
- await fetch_comment(id)¶
Fetch a comment by its ID.
- Parameters:
id (int) – The ID of the comment to fetch.
- Return type:
- await fetch_review(game)¶
Fetch this user’s review for a game.
- Parameters:
game (Game) – The games to fetch the reviews for.
- Return type:
- await fetch_reviews(*games)¶
Fetch this user’s review for games.
- Parameters:
games (Game) – The games to fetch the reviews for.
- Return type:
- staticmethod await from_url(url, session=None)¶
A helper function creates a SteamID instance from a Steam community url.
Note
See
id64_from_url()for the full parameter list.- Return type:
- await games(*, include_free=True)¶
Fetches the
Games the user owns.- Parameters:
include_free (bool) – Whether to include free games in the list. Defaults to
True.- Return type:
- property id: ID32¶
The SteamID’s 32-bit ID.
- property id2_zero: str¶
The SteamID’s ID 2 accounted for bugged GoldSrc and Orange Box games.
Note
In these games the accounts
universe,1forType.Public, should be theXcomponent ofSTEAM_X:0:1234however, this was bugged and the value ofXwas0.e.g
STEAM_0:0:1234.
- property id64: ID64¶
The SteamID’s 64-bit ID.
- property instance: InstanceFlag¶
The instance of the SteamID.
- property invite_code: str | None¶
The SteamID’s invite code in the s.team invite code format.
e.g.
cv-dgb.
- await is_banned()¶
Specifies if the user is banned from any part of Steam.
Shorthand for:
bans = await user.bans() bans.is_banned()
- Return type:
- await level()¶
Fetches the user’s level if your account is premium, otherwise it’s cached.
- Return type:
- await profile_customisation_info(*, language=None)¶
Fetch a user’s profile customisation information.
- async for ... in published_files(*, game=None, revision=PublishedFileRevision.Default, type=PublishedFileType.Community, language=None, limit=None, before=None, after=None)¶
An
AsyncIteratorfor accessing a user’sPublishedFiles.Examples
Usage:
async for file in user.published_files(limit=10): print("Author:", file.author, "Published:", file.name)
Flattening into a list:
files = await user.published_files(limit=50).flatten() # files is now a list of PublishedFile
All parameters are optional.
- Parameters:
game (Optional[Game]) – The game to fetch published files in.
type (PublishedFileType) – The type of published file to fetch.
revision (PublishedFileRevision) – The desired revision of the published file to fetch.
language (Optional[Language]) – The language to fetch the published file in. If
None, the current language is used.limit (Optional[int]) – The maximum number of published files to search through. Setting this to
Nonewill fetch all of the user’s published files.before (Optional[datetime]) – A time to search for published files before.
after (Optional[datetime]) – A time to search for published files after.
- Yields:
- async for ... in reviews(*, limit=None, before=None, after=None)¶
An
AsyncIteratorfor accessing a user’sReviews.Examples
Usage:
async for review in user.reviews(limit=10): print(f"Author: {review.author} {'recommended' if review.recommend 'doesn\'t recommend'} {review.game}")
Flattening into a list:
reviews = await user.reviews(limit=50).flatten() # reviews is now a list of Review
All parameters are optional.
- await wishlist()¶
Get the
WishlistGames the user has on their wishlist.- Return type:
- asyncadd
- asyncbadges
- asyncbans
- asyncblock
- asynccancel_invite
- asyncclans
- asynccomment
- async forcomments
- asyncequipped_profile_items
- asyncescrow
- asyncfavourite_badge
- asyncfetch_comment
- asyncfetch_review
- asyncfetch_reviews
- asyncfriends
- asyncgames
- asyncis_banned
- defis_commentable
- defis_friend
- defis_private
- defis_valid
- asynclevel
- asyncprofile
- asyncprofile_customisation_info
- async forpublished_files
- asyncremove
- async forreviews
- asyncsend
- asyncunblock
- asyncwishlist
- class steam.User¶
Represents a Steam user’s account.
- x == y
Checks if two users are equal.
- str(x)
Returns the user’s name.
- state¶
The current persona state of the account (e.g. LookingToTrade).
- Type:
Optional[steam.enums.PersonaState]
- game¶
The Game instance attached to the user. Is
Noneif the user isn’t in a game or one that is recognised by the api.- Type:
Optional[steam.StatefulGame]
- primary_clan¶
The user’s primary clan.
- Type:
Optional[steam.Clan]
- created_at¶
The time at which the user’s account was created. Could be
None.- Type:
Optional[datetime.datetime]
- last_logon¶
The last time the user logged into steam. This is only
Noneif user hasn’t been updated from the websocket.- Type:
Optional[datetime.datetime]
- last_logoff¶
The last time the user logged off from steam. Could be
None(e.g. if they are currently online).- Type:
Optional[datetime.datetime]
- last_seen_online¶
The last time the user could be seen online. This is only
Noneif user hasn’t been updated from the websocket.- Type:
Optional[datetime.datetime]
- flags¶
The persona state flags of the account.
- Type:
Optional[steam.enums.PersonaStateFlag]
- await add()¶
Sends a friend invite to the user to your friends list.
- await remove()¶
Remove the user from your friends list.
- await cancel_invite()¶
Cancels an invitation sent to the user. This effectively does the same thing as
remove().
- await block()¶
Blocks the user.
- await unblock()¶
Unblocks the user.
- await escrow(token=None)¶
Check how long any received items would take to arrive.
Noneif the user has no escrow or has a private inventory.
- await send(content=None, *, trade=None, image=None)¶
Send a message, trade or image to an
User.- Parameters:
content (Any) – The message to send to the user.
trade (TradeOffer | None) –
The trade offer to send to the user.
Note
This will have its
idattribute updated after being sent.image (Image | None) – The image to send to the user.
- Raises:
HTTPException – Sending the message failed.
Forbidden – You do not have permission to send the message.
- Returns:
The sent message only applicable if
contentis passed.- Return type:
- is_friend()¶
Whether the user is in the
ClientUser’s friends.- Return type:
- await badges()¶
Fetches the user’s
UserBadgess.- Return type:
- await comment(content, *, subscribe=True)¶
Post a comment to a comments section.
- Parameters:
- Returns:
The created comment.
- Return type:
- async for ... in comments(*, oldest_first=False, limit=None, before=None, after=None)¶
An
AsyncIteratorfor accessing a comment section’sCommentobjects.Examples
Usage:
async for comment in commentable.comments(limit=10): print("Author:", comment.author, "Said:", comment.content)
Flattening into a list:
comments = await commentable.comments(limit=50).flatten() # comments is now a list of Comment
All parameters are optional.
- Parameters:
oldest_first (bool) – Whether or not to request comments with the oldest comments first or last. Defaults to
False.limit (Optional[int]) – The maximum number of comments to search through. Default is
Nonewhich will fetch the all the comments in the comments section.before (Optional[datetime]) – A time to search for comments before.
after (Optional[datetime]) – A time to search for comments after.
- Yields:
- await equipped_profile_items(*, language=None)¶
The user’s equipped profile items.
- await favourite_badge()¶
The user’s favourite badge.
- Return type:
- await fetch_comment(id)¶
Fetch a comment by its ID.
- Parameters:
id (int) – The ID of the comment to fetch.
- Return type:
- await fetch_review(game)¶
Fetch this user’s review for a game.
- Parameters:
game (Game) – The games to fetch the reviews for.
- Return type:
- await fetch_reviews(*games)¶
Fetch this user’s review for games.
- Parameters:
games (Game) – The games to fetch the reviews for.
- Return type:
- await friends()¶
Fetch the list of the users friends.
- Return type:
- staticmethod await from_url(url, session=None)¶
A helper function creates a SteamID instance from a Steam community url.
Note
See
id64_from_url()for the full parameter list.- Return type:
- await games(*, include_free=True)¶
Fetches the
Games the user owns.- Parameters:
include_free (bool) – Whether to include free games in the list. Defaults to
True.- Return type:
- property id: ID32¶
The SteamID’s 32-bit ID.
- property id2_zero: str¶
The SteamID’s ID 2 accounted for bugged GoldSrc and Orange Box games.
Note
In these games the accounts
universe,1forType.Public, should be theXcomponent ofSTEAM_X:0:1234however, this was bugged and the value ofXwas0.e.g
STEAM_0:0:1234.
- property id64: ID64¶
The SteamID’s 64-bit ID.
- property instance: InstanceFlag¶
The instance of the SteamID.
- property invite_code: str | None¶
The SteamID’s invite code in the s.team invite code format.
e.g.
cv-dgb.
- await is_banned()¶
Specifies if the user is banned from any part of Steam.
Shorthand for:
bans = await user.bans() bans.is_banned()
- Return type:
- await level()¶
Fetches the user’s level if your account is premium, otherwise it’s cached.
- Return type:
- await profile(*, language=None)¶
Fetch a user’s entire profile information.
- Parameters:
language (Optional[Language]) – The language to fetch the profile items in. If
Nonethe current language is used
Note
This calls all the profile related functions to return a Profile object which has all the info set.
- Return type:
- await profile_customisation_info(*, language=None)¶
Fetch a user’s profile customisation information.
- async for ... in published_files(*, game=None, revision=PublishedFileRevision.Default, type=PublishedFileType.Community, language=None, limit=None, before=None, after=None)¶
An
AsyncIteratorfor accessing a user’sPublishedFiles.Examples
Usage:
async for file in user.published_files(limit=10): print("Author:", file.author, "Published:", file.name)
Flattening into a list:
files = await user.published_files(limit=50).flatten() # files is now a list of PublishedFile
All parameters are optional.
- Parameters:
game (Optional[Game]) – The game to fetch published files in.
type (PublishedFileType) – The type of published file to fetch.
revision (PublishedFileRevision) – The desired revision of the published file to fetch.
language (Optional[Language]) – The language to fetch the published file in. If
None, the current language is used.limit (Optional[int]) – The maximum number of published files to search through. Setting this to
Nonewill fetch all of the user’s published files.before (Optional[datetime]) – A time to search for published files before.
after (Optional[datetime]) – A time to search for published files after.
- Yields:
- async for ... in reviews(*, limit=None, before=None, after=None)¶
An
AsyncIteratorfor accessing a user’sReviews.Examples
Usage:
async for review in user.reviews(limit=10): print(f"Author: {review.author} {'recommended' if review.recommend 'doesn\'t recommend'} {review.game}")
Flattening into a list:
reviews = await user.reviews(limit=50).flatten() # reviews is now a list of Review
All parameters are optional.
- await wishlist()¶
Get the
WishlistGames the user has on their wishlist.- Return type:
- asyncadd
- asyncbadges
- asyncbans
- asyncblock
- asynccancel_invite
- asyncclans
- asynccomment
- async forcomments
- asyncequipped_profile_items
- asyncescrow
- asyncfavourite_badge
- asyncfetch_comment
- asyncfetch_review
- asyncfetch_reviews
- asyncfriends
- asyncgames
- asyncinvite_to_clan
- asyncinvite_to_group
- asyncis_banned
- defis_commentable
- defis_friend
- defis_private
- defis_valid
- asynclevel
- asyncowns
- asyncprofile
- asyncprofile_customisation_info
- asyncprofile_info
- async forpublished_files
- asyncremove
- async forreviews
- asyncsend
- asyncunblock
- asyncwishlist
- class steam.Friend¶
Represents a Steam user’s account.
- x == y
Checks if two users are equal.
- str(x)
Returns the user’s name.
- state¶
The current persona state of the account (e.g. LookingToTrade).
- Type:
Optional[steam.enums.PersonaState]
- game¶
The Game instance attached to the user. Is
Noneif the user isn’t in a game or one that is recognised by the api.- Type:
Optional[steam.StatefulGame]
- primary_clan¶
The user’s primary clan.
- Type:
Optional[steam.Clan]
- created_at¶
The time at which the user’s account was created. Could be
None.- Type:
Optional[datetime.datetime]
- last_logon¶
The last time the user logged into steam. This is only
Noneif user hasn’t been updated from the websocket.- Type:
Optional[datetime.datetime]
- last_logoff¶
The last time the user logged off from steam. Could be
None(e.g. if they are currently online).- Type:
Optional[datetime.datetime]
- last_seen_online¶
The last time the user could be seen online. This is only
Noneif user hasn’t been updated from the websocket.- Type:
Optional[datetime.datetime]
- flags¶
The persona state flags of the account.
- Type:
Optional[steam.enums.PersonaStateFlag]
- await add()¶
Sends a friend invite to the user to your friends list.
- property avatar_url¶
attrgetter(attr, …) –> attrgetter object
Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).
- await badges()¶
Fetches the user’s
UserBadgess.- Return type:
- await block()¶
Blocks the user.
- await cancel_invite()¶
Cancels an invitation sent to the user. This effectively does the same thing as
remove().
- await comment(content, *, subscribe=True)¶
Post a comment to a comments section.
- Parameters:
- Returns:
The created comment.
- Return type:
- property comment_permissions¶
attrgetter(attr, …) –> attrgetter object
Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).
- async for ... in comments(*, oldest_first=False, limit=None, before=None, after=None)¶
An
AsyncIteratorfor accessing a comment section’sCommentobjects.Examples
Usage:
async for comment in commentable.comments(limit=10): print("Author:", comment.author, "Said:", comment.content)
Flattening into a list:
comments = await commentable.comments(limit=50).flatten() # comments is now a list of Comment
All parameters are optional.
- Parameters:
oldest_first (bool) – Whether or not to request comments with the oldest comments first or last. Defaults to
False.limit (Optional[int]) – The maximum number of comments to search through. Default is
Nonewhich will fetch the all the comments in the comments section.before (Optional[datetime]) – A time to search for comments before.
after (Optional[datetime]) – A time to search for comments after.
- Yields:
- property community_url¶
attrgetter(attr, …) –> attrgetter object
Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).
- property country¶
attrgetter(attr, …) –> attrgetter object
Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).
- property created_at¶
attrgetter(attr, …) –> attrgetter object
Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).
- await equipped_profile_items(*, language=None)¶
The user’s equipped profile items.
- await escrow(token=None)¶
Check how long any received items would take to arrive.
Noneif the user has no escrow or has a private inventory.
- await favourite_badge()¶
The user’s favourite badge.
- Return type:
- await fetch_comment(id)¶
Fetch a comment by its ID.
- Parameters:
id (int) – The ID of the comment to fetch.
- Return type:
- await fetch_review(game)¶
Fetch this user’s review for a game.
- Parameters:
game (Game) – The games to fetch the reviews for.
- Return type:
- await fetch_reviews(*games)¶
Fetch this user’s review for games.
- Parameters:
games (Game) – The games to fetch the reviews for.
- Return type:
- property flags¶
attrgetter(attr, …) –> attrgetter object
Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).
- await friends()¶
Fetch the list of the users friends.
- Return type:
- staticmethod await from_url(url, session=None)¶
A helper function creates a SteamID instance from a Steam community url.
Note
See
id64_from_url()for the full parameter list.- Return type:
- property game¶
attrgetter(attr, …) –> attrgetter object
Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).
- await games(*, include_free=True)¶
Fetches the
Games the user owns.- Parameters:
include_free (bool) – Whether to include free games in the list. Defaults to
True.- Return type:
- property id: ID32¶
The SteamID’s 32-bit ID.
- property id2_zero: str¶
The SteamID’s ID 2 accounted for bugged GoldSrc and Orange Box games.
Note
In these games the accounts
universe,1forType.Public, should be theXcomponent ofSTEAM_X:0:1234however, this was bugged and the value ofXwas0.e.g
STEAM_0:0:1234.
- property id64: ID64¶
The SteamID’s 64-bit ID.
- property instance: InstanceFlag¶
The instance of the SteamID.
- property invite_code: str | None¶
The SteamID’s invite code in the s.team invite code format.
e.g.
cv-dgb.
- await invite_to_clan(clan)¶
Invites the user to a
Clan.- Parameters:
clan (Clan) – The clan to invite the user to.
- await invite_to_group(group)¶
Invites the user to a
Group.- Parameters:
group (Group) – The group to invite the user to.
- await is_banned()¶
Specifies if the user is banned from any part of Steam.
Shorthand for:
bans = await user.bans() bans.is_banned()
- Return type:
- is_friend()¶
Whether the user is in the
ClientUser’s friends.- Return type:
- property last_logoff¶
attrgetter(attr, …) –> attrgetter object
Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).
- property last_logon¶
attrgetter(attr, …) –> attrgetter object
Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).
- property last_seen_online¶
attrgetter(attr, …) –> attrgetter object
Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).
- await level()¶
Fetches the user’s level if your account is premium, otherwise it’s cached.
- Return type:
- property name¶
attrgetter(attr, …) –> attrgetter object
Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).
- await owns(game)¶
Whether the game is owned by this friend.
- property primary_clan¶
attrgetter(attr, …) –> attrgetter object
Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).
- property privacy_state¶
attrgetter(attr, …) –> attrgetter object
Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).
- await profile(*, language=None)¶
Fetch a user’s entire profile information.
- Parameters:
language (Optional[Language]) – The language to fetch the profile items in. If
Nonethe current language is used
Note
This calls all the profile related functions to return a Profile object which has all the info set.
- Return type:
steam.profile.FriendProfile
- await profile_customisation_info(*, language=None)¶
Fetch a user’s profile customisation information.
- await profile_info()¶
The friend’s profile info.
- Return type:
- property profile_state¶
attrgetter(attr, …) –> attrgetter object
Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).
- async for ... in published_files(*, game=None, revision=PublishedFileRevision.Default, type=PublishedFileType.Community, language=None, limit=None, before=None, after=None)¶
An
AsyncIteratorfor accessing a user’sPublishedFiles.Examples
Usage:
async for file in user.published_files(limit=10): print("Author:", file.author, "Published:", file.name)
Flattening into a list:
files = await user.published_files(limit=50).flatten() # files is now a list of PublishedFile
All parameters are optional.
- Parameters:
game (Optional[Game]) – The game to fetch published files in.
type (PublishedFileType) – The type of published file to fetch.
revision (PublishedFileRevision) – The desired revision of the published file to fetch.
language (Optional[Language]) – The language to fetch the published file in. If
None, the current language is used.limit (Optional[int]) – The maximum number of published files to search through. Setting this to
Nonewill fetch all of the user’s published files.before (Optional[datetime]) – A time to search for published files before.
after (Optional[datetime]) – A time to search for published files after.
- Yields:
- property real_name¶
attrgetter(attr, …) –> attrgetter object
Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).
- await remove()¶
Remove the user from your friends list.
- async for ... in reviews(*, limit=None, before=None, after=None)¶
An
AsyncIteratorfor accessing a user’sReviews.Examples
Usage:
async for review in user.reviews(limit=10): print(f"Author: {review.author} {'recommended' if review.recommend 'doesn\'t recommend'} {review.game}")
Flattening into a list:
reviews = await user.reviews(limit=50).flatten() # reviews is now a list of Review
All parameters are optional.
- property rich_presence¶
attrgetter(attr, …) –> attrgetter object
Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).
- await send(content=None, *, trade=None, image=None)¶
Send a message, trade or image to an
User.- Parameters:
- Raises:
HTTPException – Sending the message failed.
Forbidden – You do not have permission to send the message.
- Returns:
The sent message only applicable if
contentis passed.- Return type:
- property state¶
attrgetter(attr, …) –> attrgetter object
Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).
- property trade_url¶
attrgetter(attr, …) –> attrgetter object
Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).
- await unblock()¶
Unblocks the user.
- await wishlist()¶
Get the
WishlistGames the user has on their wishlist.- Return type:
Data-Classes¶
There are a few classes that can be constructed by the user, these include.
Game¶
- class steam.Game(*, id=None, name=None, title=None, context_id=None)¶
Represents a Steam game.
There are some predefined games which are:
Game Name |
Accessed via |
|---|---|
Team Fortress 2 |
|
DOTA2 |
|
Counter Strike Global-Offensive |
|
Left for Dead 2 |
|
Steam |
|
Games can be manually constructed using there app id eg:
my_rust_instance = steam.Game(id=252490, name="Rust")
# this can then be used for trading a game name is not required for this
# but it is for setting in game statuses if the game isn't a Steam game.
- steam.CUSTOM_GAME(name: str) Game¶
Create a custom game instance for
change_presence(). TheGame.idwill be set to15190414816125648896and theGame.context_idtoNone.Example:
await client.change_presence(game=steam.CUSTOM_GAME("my cool game"))
- Parameters:
name – The name of the game to set your playing status to.
- Return type:
- asyncadd_free_licenses
- asyncclan
- asyncdlc
- asyncfetch
- asyncfetch_manifest
- asyncfriend_thoughts
- asyncfriends_who_own
- asyncinfo
- defis_steam_game
- async formanifests
- asyncpackages
- asyncplayer_count
- async forpublished_files
- asyncreview
- async forreviews
- class steam.game.StatefulGame¶
Games that have state.
- await add_free_licenses()¶
Request the free licenses for this game.
- Raises:
ValueError – No licenses were granted.
- Return type:
- await clan()¶
Fetch this game’s clan.
This can be useful to get a Game’s updates.
clan = await game.clan() async for update in clan.announcements().filter( lambda announcement: announcement.type in (steam.ClanEvent.MajorUpdate, steam.ClanEvent.SmallUpdate) ): ... # do something with the update
- Raises:
ValueError – This game has no associated clan.
- Return type:
- await dlc(*, language=None)¶
Fetch the game’s DLC.
- await fetch(*, language=None)¶
Shorthand for:
game = await client.fetch_game(game)
- Return type:
- await fetch_manifest(*, id, depot_id, branch='public', password_hash='')¶
Fetch a CDN manifest for a game.
- Parameters:
- Return type:
- await friend_thoughts()¶
Fetch the client user’s friends who recommended and didn’t recommend this game in a review.
- Return type:
- await friends_who_own()¶
Fetch the users in your friend list who own this game.
- Return type:
- await info()¶
Shorthand for:
(info,) = await client.fetch_product_info(games=[game])
- Return type:
- async for ... in manifests(*, limit=100, before=None, after=None, branch='public', password=None, password_hash='')¶
An
AsyncIteratorfor accessing asteam.Game’ssteam.Manifests.Examples
Usage:
async for manifest in game.manifests(limit=10): print("Manifest:", manifest.name) print(f"Contains {len(manifest.paths)} manifests")
Flattening into a list:
manifests = await game.manifests(limit=50).flatten() # manifests is now a list of Manifest
All parameters are optional.
- Parameters:
limit (int | None) – The maximum number of
Manifeststo return.before (Optional[datetime]) – The time to get manifests before.
after (Optional[datetime]) – The time to get manifests after.
branch (str) – The name of the branch to fetch manifests from.
password (Optional[str]) – The password for the branch, if any.
password_hash (str) – The hashed password for a manifest.
- Yields:
Manifest
- await packages(*, language=None)¶
Fetch the game’s packages.
- Parameters:
language (Language | None) – The language to fetch the packages in. If
None, the current language will be used.- Return type:
- async for ... in published_files(*, type=PublishedFileQueryFileType.Items, revision=PublishedFileRevision.Default, language=None, limit=100, before=None, after=None)¶
An
AsyncIteratorfor accessing a game’ssteam.PublishedFiles.Examples
Usage:
async for published_file in game.published_files(limit=10): print("Published file:", published_file.name) print("Published at:", published_file.created_at) print("Published by:", published_file.author)
Flattening into a list:
published_files = await game.published_files(limit=50).flatten() # published_files is now a list of PublishedFile
All parameters are optional.
- Parameters:
type (PublishedFileQueryFileType) – The type of published files to fetch.
revision (PublishedFileRevision) – The desired revision of the published files to fetch.
language (Optional[Language]) – The language to fetch the published files in. If
Nonethe current language is used.limit (int | None) – The maximum number of published files to search through. Default is
100. Setting this toNonewill fetch all the game’s published files, but this will be a very slow operation.before (Optional[datetime]) – A time to search for published files before.
after (Optional[datetime]) – A time to search for published files after.
- Yields:
- await review(content, *, recommend, public=True, commentable=True, received_compensation=False, language=None)¶
Review a game.
- Parameters:
content (str) – The content of the review.
recommend (bool) – Whether you recommended the game.
public (bool) – Whether the review should be public.
commentable (bool) – Whether the review should allow comments.
received_compensation (bool) – Whether you received compensation for this review.
language (Language | None) – The language the review is in.
- Return type:
- async for ... in reviews(*, limit=100, before=None, after=None)¶
An
AsyncIteratorfor accessing asteam.Game’ssteam.Reviews.Examples
Usage:
async for review in game.reviews(limit=10): print("Reviewer:", review.author) print("Said:", review.content)
Flattening into a list:
reviews = await game.reviews(limit=50).flatten() # reviews is now a list of Review
All parameters are optional.
- Parameters:
limit (int | None) – The maximum number of reviews to search through. Default is
100. Setting this toNonewill fetch all the game’s reviews, but this will be a very slow operation.before (Optional[datetime]) – A time to search for reviews before.
after (Optional[datetime]) – A time to search for reviews after.
- Yields:
- asyncadd_free_licenses
- asyncclan
- asyncdlc
- asyncfetch
- asyncfetch_manifest
- asyncfriend_thoughts
- asyncfriends_who_own
- defhas_visible_stats
- asyncinfo
- defis_steam_game
- async formanifests
- asyncpackages
- asyncplayer_count
- async forpublished_files
- asyncreview
- async forreviews
- class steam.UserGame¶
Represents a Steam game fetched by
steam.User.games()- playtime_forever¶
The total time the game has been played for.
- Type:
- playtime_two_weeks¶
The amount of time the user has played the game in the last two weeks.
- Type:
- playtime_windows¶
The total amount of time the user has played the game on Windows.
- Type:
- playtime_mac_os¶
The total amount of time the user has played the game on macOS.
- Type:
- playtime_linux¶
The total amount of time the user has played the game on Linux.
- Type:
- last_played_at¶
The time the user last played this game at.
- Type:
- await add_free_licenses()¶
Request the free licenses for this game.
- Raises:
ValueError – No licenses were granted.
- Return type:
- await clan()¶
Fetch this game’s clan.
This can be useful to get a Game’s updates.
clan = await game.clan() async for update in clan.announcements().filter( lambda announcement: announcement.type in (steam.ClanEvent.MajorUpdate, steam.ClanEvent.SmallUpdate) ): ... # do something with the update
- Raises:
ValueError – This game has no associated clan.
- Return type:
- await dlc(*, language=None)¶
Fetch the game’s DLC.
- await fetch(*, language=None)¶
Shorthand for:
game = await client.fetch_game(game)
- Return type:
- await fetch_manifest(*, id, depot_id, branch='public', password_hash='')¶
Fetch a CDN manifest for a game.
- Parameters:
- Return type:
- await friend_thoughts()¶
Fetch the client user’s friends who recommended and didn’t recommend this game in a review.
- Return type:
- await friends_who_own()¶
Fetch the users in your friend list who own this game.
- Return type:
- await info()¶
Shorthand for:
(info,) = await client.fetch_product_info(games=[game])
- Return type:
- async for ... in manifests(*, limit=100, before=None, after=None, branch='public', password=None, password_hash='')¶
An
AsyncIteratorfor accessing asteam.Game’ssteam.Manifests.Examples
Usage:
async for manifest in game.manifests(limit=10): print("Manifest:", manifest.name) print(f"Contains {len(manifest.paths)} manifests")
Flattening into a list:
manifests = await game.manifests(limit=50).flatten() # manifests is now a list of Manifest
All parameters are optional.
- Parameters:
limit (Optional[int]) – The maximum number of
Manifeststo return.before (Optional[datetime]) – The time to get manifests before.
after (Optional[datetime]) – The time to get manifests after.
branch (str) – The name of the branch to fetch manifests from.
password (Optional[str]) – The password for the branch, if any.
password_hash (str) – The hashed password for a manifest.
- Yields:
- await packages(*, language=None)¶
Fetch the game’s packages.
- async for ... in published_files(*, type=PublishedFileQueryFileType.Items, revision=PublishedFileRevision.Default, language=None, limit=100, before=None, after=None)¶
An
AsyncIteratorfor accessing a game’ssteam.PublishedFiles.Examples
Usage:
async for published_file in game.published_files(limit=10): print("Published file:", published_file.name) print("Published at:", published_file.created_at) print("Published by:", published_file.author)
Flattening into a list:
published_files = await game.published_files(limit=50).flatten() # published_files is now a list of PublishedFile
All parameters are optional.
- Parameters:
type (PublishedFileQueryFileType) – The type of published files to fetch.
revision (PublishedFileRevision) – The desired revision of the published files to fetch.
language (Optional[Language]) – The language to fetch the published files in. If
Nonethe current language is used.limit (Optional[int]) – The maximum number of published files to search through. Default is
100. Setting this toNonewill fetch all the game’s published files, but this will be a very slow operation.before (Optional[datetime]) – A time to search for published files before.
after (Optional[datetime]) – A time to search for published files after.
- Yields:
- await review(content, *, recommend, public=True, commentable=True, received_compensation=False, language=None)¶
Review a game.
- Parameters:
content (str) – The content of the review.
recommend (bool) – Whether you recommended the game.
public (bool) – Whether the review should be public.
commentable (bool) – Whether the review should allow comments.
received_compensation (bool) – Whether you received compensation for this review.
language (Optional[Language]) – The language the review is in.
- Return type:
- async for ... in reviews(*, limit=100, before=None, after=None)¶
An
AsyncIteratorfor accessing asteam.Game’ssteam.Reviews.Examples
Usage:
async for review in game.reviews(limit=10): print("Reviewer:", review.author) print("Said:", review.content)
Flattening into a list:
reviews = await game.reviews(limit=50).flatten() # reviews is now a list of Review
All parameters are optional.
- Parameters:
limit (Optional[int]) – The maximum number of reviews to search through. Default is
100. Setting this toNonewill fetch all the game’s reviews, but this will be a very slow operation.before (Optional[datetime]) – A time to search for reviews before.
after (Optional[datetime]) – A time to search for reviews after.
- Yields:
- asyncadd_free_licenses
- asyncclan
- asyncdlc
- asyncfetch
- asyncfetch_manifest
- asyncfriend_thoughts
- asyncfriends_who_own
- asyncinfo
- defis_free
- defis_on_linux
- defis_on_mac_os
- defis_on_windows
- defis_steam_game
- async formanifests
- asyncpackages
- asyncplayer_count
- async forpublished_files
- asyncreview
- async forreviews
- class steam.WishlistGame¶
Represents a Steam game fetched by
steam.User.wishlist().- added_at¶
The time that the game was added to their wishlist.
- Type:
- created_at¶
The time the game was uploaded at.
- Type:
- review_status¶
The review status of the game.
- Type:
Any
- await add_free_licenses()¶
Request the free licenses for this game.
- Raises:
ValueError – No licenses were granted.
- Return type:
- await clan()¶
Fetch this game’s clan.
This can be useful to get a Game’s updates.
clan = await game.clan() async for update in clan.announcements().filter( lambda announcement: announcement.type in (steam.ClanEvent.MajorUpdate, steam.ClanEvent.SmallUpdate) ): ... # do something with the update
- Raises:
ValueError – This game has no associated clan.
- Return type:
- await dlc(*, language=None)¶
Fetch the game’s DLC.
- await fetch(*, language=None)¶
Shorthand for:
game = await client.fetch_game(game)
- Return type:
- await fetch_manifest(*, id, depot_id, branch='public', password_hash='')¶
Fetch a CDN manifest for a game.
- Parameters:
- Return type:
- await friend_thoughts()¶
Fetch the client user’s friends who recommended and didn’t recommend this game in a review.
- Return type:
- await friends_who_own()¶
Fetch the users in your friend list who own this game.
- Return type:
- await info()¶
Shorthand for:
(info,) = await client.fetch_product_info(games=[game])
- Return type:
- async for ... in manifests(*, limit=100, before=None, after=None, branch='public', password=None, password_hash='')¶
An
AsyncIteratorfor accessing asteam.Game’ssteam.Manifests.Examples
Usage:
async for manifest in game.manifests(limit=10): print("Manifest:", manifest.name) print(f"Contains {len(manifest.paths)} manifests")
Flattening into a list:
manifests = await game.manifests(limit=50).flatten() # manifests is now a list of Manifest
All parameters are optional.
- Parameters:
limit (Optional[int]) – The maximum number of
Manifeststo return.before (Optional[datetime]) – The time to get manifests before.
after (Optional[datetime]) – The time to get manifests after.
branch (str) – The name of the branch to fetch manifests from.
password (Optional[str]) – The password for the branch, if any.
password_hash (str) – The hashed password for a manifest.
- Yields:
- await packages(*, language=None)¶
Fetch the game’s packages.
- async for ... in published_files(*, type=PublishedFileQueryFileType.Items, revision=PublishedFileRevision.Default, language=None, limit=100, before=None, after=None)¶
An
AsyncIteratorfor accessing a game’ssteam.PublishedFiles.Examples
Usage:
async for published_file in game.published_files(limit=10): print("Published file:", published_file.name) print("Published at:", published_file.created_at) print("Published by:", published_file.author)
Flattening into a list:
published_files = await game.published_files(limit=50).flatten() # published_files is now a list of PublishedFile
All parameters are optional.
- Parameters:
type (PublishedFileQueryFileType) – The type of published files to fetch.
revision (PublishedFileRevision) – The desired revision of the published files to fetch.
language (Optional[Language]) – The language to fetch the published files in. If
Nonethe current language is used.limit (Optional[int]) – The maximum number of published files to search through. Default is
100. Setting this toNonewill fetch all the game’s published files, but this will be a very slow operation.before (Optional[datetime]) – A time to search for published files before.
after (Optional[datetime]) – A time to search for published files after.
- Yields:
- await review(content, *, recommend, public=True, commentable=True, received_compensation=False, language=None)¶
Review a game.
- Parameters:
content (str) – The content of the review.
recommend (bool) – Whether you recommended the game.
public (bool) – Whether the review should be public.
commentable (bool) – Whether the review should allow comments.
received_compensation (bool) – Whether you received compensation for this review.
language (Optional[Language]) – The language the review is in.
- Return type:
- async for ... in reviews(*, limit=100, before=None, after=None)¶
An
AsyncIteratorfor accessing asteam.Game’ssteam.Reviews.Examples
Usage:
async for review in game.reviews(limit=10): print("Reviewer:", review.author) print("Said:", review.content)
Flattening into a list:
reviews = await game.reviews(limit=50).flatten() # reviews is now a list of Review
All parameters are optional.
- Parameters:
limit (Optional[int]) – The maximum number of reviews to search through. Default is
100. Setting this toNonewill fetch all the game’s reviews, but this will be a very slow operation.before (Optional[datetime]) – A time to search for reviews before.
after (Optional[datetime]) – A time to search for reviews after.
- Yields:
- asyncadd_free_licenses
- asyncclan
- asyncdlc
- asyncfetch
- asyncfetch_manifest
- asyncfriend_thoughts
- asyncfriends_who_own
- asyncinfo
- defis_free
- defis_on_linux
- defis_on_mac_os
- defis_on_windows
- defis_steam_game
- async formanifests
- asyncpackages
- asyncplayer_count
- async forpublished_files
- asyncreview
- async forreviews
- class steam.FetchedGame¶
Represents a Steam game fetched by
steam.Client.fetch_game().- created_at¶
The time the game was uploaded at.
- Type:
Optional[datetime.datetime]
- type¶
The type of the app.
- partial_dlc¶
The game’s downloadable content.
- Type:
- movies¶
A list of the game’s movies, each of which has
name,id,urland optionalcreated_atattributes.- Type:
Optional[list[steam.game.Movie]]
- price_overview¶
The price overview of the game.
- Type:
steam.game.GamePriceOverview
- await add_free_licenses()¶
Request the free licenses for this game.
- Raises:
ValueError – No licenses were granted.
- Return type:
- await clan()¶
Fetch this game’s clan.
This can be useful to get a Game’s updates.
clan = await game.clan() async for update in clan.announcements().filter( lambda announcement: announcement.type in (steam.ClanEvent.MajorUpdate, steam.ClanEvent.SmallUpdate) ): ... # do something with the update
- Raises:
ValueError – This game has no associated clan.
- Return type:
- await dlc(*, language=None)¶
Fetch the game’s DLC.
- await fetch(*, language=None)¶
Shorthand for:
game = await client.fetch_game(game)
- Return type:
- await fetch_manifest(*, id, depot_id, branch='public', password_hash='')¶
Fetch a CDN manifest for a game.
- Parameters:
- Return type:
- await friend_thoughts()¶
Fetch the client user’s friends who recommended and didn’t recommend this game in a review.
- Return type:
- await friends_who_own()¶
Fetch the users in your friend list who own this game.
- Return type:
- await info()¶
Shorthand for:
(info,) = await client.fetch_product_info(games=[game])
- Return type:
- async for ... in manifests(*, limit=100, before=None, after=None, branch='public', password=None, password_hash='')¶
An
AsyncIteratorfor accessing asteam.Game’ssteam.Manifests.Examples
Usage:
async for manifest in game.manifests(limit=10): print("Manifest:", manifest.name) print(f"Contains {len(manifest.paths)} manifests")
Flattening into a list:
manifests = await game.manifests(limit=50).flatten() # manifests is now a list of Manifest
All parameters are optional.
- Parameters:
limit (Optional[int]) – The maximum number of
Manifeststo return.before (Optional[datetime]) – The time to get manifests before.
after (Optional[datetime]) – The time to get manifests after.
branch (str) – The name of the branch to fetch manifests from.
password (Optional[str]) – The password for the branch, if any.
password_hash (str) – The hashed password for a manifest.
- Yields:
- async for ... in published_files(*, type=PublishedFileQueryFileType.Items, revision=PublishedFileRevision.Default, language=None, limit=100, before=None, after=None)¶
An
AsyncIteratorfor accessing a game’ssteam.PublishedFiles.Examples
Usage:
async for published_file in game.published_files(limit=10): print("Published file:", published_file.name) print("Published at:", published_file.created_at) print("Published by:", published_file.author)
Flattening into a list:
published_files = await game.published_files(limit=50).flatten() # published_files is now a list of PublishedFile
All parameters are optional.
- Parameters:
type (PublishedFileQueryFileType) – The type of published files to fetch.
revision (PublishedFileRevision) – The desired revision of the published files to fetch.
language (Optional[Language]) – The language to fetch the published files in. If
Nonethe current language is used.limit (Optional[int]) – The maximum number of published files to search through. Default is
100. Setting this toNonewill fetch all the game’s published files, but this will be a very slow operation.before (Optional[datetime]) – A time to search for published files before.
after (Optional[datetime]) – A time to search for published files after.
- Yields:
- await review(content, *, recommend, public=True, commentable=True, received_compensation=False, language=None)¶
Review a game.
- Parameters:
content (str) – The content of the review.
recommend (bool) – Whether you recommended the game.
public (bool) – Whether the review should be public.
commentable (bool) – Whether the review should allow comments.
received_compensation (bool) – Whether you received compensation for this review.
language (Optional[Language]) – The language the review is in.
- Return type:
- async for ... in reviews(*, limit=100, before=None, after=None)¶
An
AsyncIteratorfor accessing asteam.Game’ssteam.Reviews.Examples
Usage:
async for review in game.reviews(limit=10): print("Reviewer:", review.author) print("Said:", review.content)
Flattening into a list:
reviews = await game.reviews(limit=50).flatten() # reviews is now a list of Review
All parameters are optional.
- Parameters:
limit (Optional[int]) – The maximum number of reviews to search through. Default is
100. Setting this toNonewill fetch all the game’s reviews, but this will be a very slow operation.before (Optional[datetime]) – A time to search for reviews before.
after (Optional[datetime]) – A time to search for reviews after.
- Yields:
- await packages(*, languages=None)¶
Fetch the game’s packages.
- Parameters:
language – The language to fetch the packages in. If
None, the current language will be used.- Return type:
- asyncadd_free_licenses
- asyncclan
- asyncdlc
- asyncfetch
- asyncfetch_manifest
- asyncfriend_thoughts
- asyncfriends_who_own
- asyncinfo
- defis_free
- defis_on_linux
- defis_on_mac_os
- defis_on_windows
- defis_steam_game
- async formanifests
- asyncpackages
- asyncplayer_count
- async forpublished_files
- asyncreview
- async forreviews
- class steam.DLC¶
Represents DLC (downloadable content) for a game.
- created_at¶
The time the DLC was released at.
- Type:
- price_overview¶
A price overview for the DLC.
- Type:
steam.game.PartialGamePriceOverview
- await add_free_licenses()¶
Request the free licenses for this game.
- Raises:
ValueError – No licenses were granted.
- Return type:
- await clan()¶
Fetch this game’s clan.
This can be useful to get a Game’s updates.
clan = await game.clan() async for update in clan.announcements().filter( lambda announcement: announcement.type in (steam.ClanEvent.MajorUpdate, steam.ClanEvent.SmallUpdate) ): ... # do something with the update
- Raises:
ValueError – This game has no associated clan.
- Return type:
- await dlc(*, language=None)¶
Fetch the game’s DLC.
- await fetch(*, language=None)¶
Shorthand for:
game = await client.fetch_game(game)
- Return type:
- await fetch_manifest(*, id, depot_id, branch='public', password_hash='')¶
Fetch a CDN manifest for a game.
- Parameters:
- Return type:
- await friend_thoughts()¶
Fetch the client user’s friends who recommended and didn’t recommend this game in a review.
- Return type:
- await friends_who_own()¶
Fetch the users in your friend list who own this game.
- Return type:
- await info()¶
Shorthand for:
(info,) = await client.fetch_product_info(games=[game])
- Return type:
- async for ... in manifests(*, limit=100, before=None, after=None, branch='public', password=None, password_hash='')¶
An
AsyncIteratorfor accessing asteam.Game’ssteam.Manifests.Examples
Usage:
async for manifest in game.manifests(limit=10): print("Manifest:", manifest.name) print(f"Contains {len(manifest.paths)} manifests")
Flattening into a list:
manifests = await game.manifests(limit=50).flatten() # manifests is now a list of Manifest
All parameters are optional.
- Parameters:
limit (Optional[int]) – The maximum number of
Manifeststo return.before (Optional[datetime]) – The time to get manifests before.
after (Optional[datetime]) – The time to get manifests after.
branch (str) – The name of the branch to fetch manifests from.
password (Optional[str]) – The password for the branch, if any.
password_hash (str) – The hashed password for a manifest.
- Yields:
- await packages(*, language=None)¶
Fetch the game’s packages.
- async for ... in published_files(*, type=PublishedFileQueryFileType.Items, revision=PublishedFileRevision.Default, language=None, limit=100, before=None, after=None)¶
An
AsyncIteratorfor accessing a game’ssteam.PublishedFiles.Examples
Usage:
async for published_file in game.published_files(limit=10): print("Published file:", published_file.name) print("Published at:", published_file.created_at) print("Published by:", published_file.author)
Flattening into a list:
published_files = await game.published_files(limit=50).flatten() # published_files is now a list of PublishedFile
All parameters are optional.
- Parameters:
type (PublishedFileQueryFileType) – The type of published files to fetch.
revision (PublishedFileRevision) – The desired revision of the published files to fetch.
language (Optional[Language]) – The language to fetch the published files in. If
Nonethe current language is used.limit (Optional[int]) – The maximum number of published files to search through. Default is
100. Setting this toNonewill fetch all the game’s published files, but this will be a very slow operation.before (Optional[datetime]) – A time to search for published files before.
after (Optional[datetime]) – A time to search for published files after.
- Yields:
- await review(content, *, recommend, public=True, commentable=True, received_compensation=False, language=None)¶
Review a game.
- Parameters:
content (str) – The content of the review.
recommend (bool) – Whether you recommended the game.
public (bool) – Whether the review should be public.
commentable (bool) – Whether the review should allow comments.
received_compensation (bool) – Whether you received compensation for this review.
language (Optional[Language]) – The language the review is in.
- Return type:
- async for ... in reviews(*, limit=100, before=None, after=None)¶
An
AsyncIteratorfor accessing asteam.Game’ssteam.Reviews.Examples
Usage:
async for review in game.reviews(limit=10): print("Reviewer:", review.author) print("Said:", review.content)
Flattening into a list:
reviews = await game.reviews(limit=50).flatten() # reviews is now a list of Review
All parameters are optional.
- Parameters:
limit (Optional[int]) – The maximum number of reviews to search through. Default is
100. Setting this toNonewill fetch all the game’s reviews, but this will be a very slow operation.before (Optional[datetime]) – A time to search for reviews before.
after (Optional[datetime]) – A time to search for reviews after.
- Yields:
Steam IDs¶
- defis_valid
- class steam.SteamID(id=0, type=None, universe=None, instance=None)¶
Convert a Steam ID between its various representations.
Note
See
steam.utils.make_id64()for the full parameter list.- property instance: InstanceFlag¶
The instance of the SteamID.
- property id64: ID64¶
The SteamID’s 64-bit ID.
- property id: ID32¶
The SteamID’s 32-bit ID.
- property id2_zero: str¶
The SteamID’s ID 2 accounted for bugged GoldSrc and Orange Box games.
Note
In these games the accounts
universe,1forType.Public, should be theXcomponent ofSTEAM_X:0:1234however, this was bugged and the value ofXwas0.e.g
STEAM_0:0:1234.
- property invite_code: str | None¶
The SteamID’s invite code in the s.team invite code format.
e.g.
cv-dgb.
- staticmethod await from_url(url, session=None)¶
A helper function creates a SteamID instance from a Steam community url.
Note
See
id64_from_url()for the full parameter list.- Return type:
TradeOffers¶
- class steam.TradeOffer(*, token: str | None = ..., message: str | None = ..., item_to_send: Asset = ..., item_to_receive: Asset = ...)¶
- class steam.TradeOffer(*, token: str | None = ..., message: str | None = ..., items_to_send: Sequence[Asset], items_to_receive: Sequence[Asset])
Represents a trade offer from/to send to a User. This can also be used in
steam.User.send().- Parameters:
item_to_send (Asset | None) – The item to send with the trade offer. Mutually exclusive to
items_to_send.item_to_receive (Asset | None) – The item to receive with the trade offer. Mutually exclusive to
items_to_receive.items_to_send (Sequence[steam.Asset]) – The items you are sending to the other user. Mutually exclusive to
item_to_send.items_to_receive (Sequence[steam.Asset]) – The items you are receiving from the other user. Mutually exclusive to
item_to_receive.token (Optional[str]) – The trade token used to send trades to users who aren’t on the ClientUser’s friend’s list.
message (Optional[str]) – The offer message to send with the trade.
- partner¶
The trade offer partner. This should only ever be a
SteamIDif the partner’s profile is private.- Type:
Union[steam.User, steam.abc.SteamID]
- items_to_send¶
A list of items to send to the partner.
- Type:
Sequence[steam.Asset]
- items_to_receive¶
A list of items to receive from the partner.
- Type:
Sequence[steam.Asset]
- state¶
The offer state of the trade for the possible types see
TradeOfferState.- Type:
- created_at¶
The time at which the trade was created.
- Type:
Optional[datetime.datetime]
- updated_at¶
The time at which the trade was last updated.
- Type:
Optional[datetime.datetime]
- expires¶
The time at which the trade automatically expires.
- Type:
Optional[datetime.datetime]
- escrow¶
The time at which the escrow will end. Can be
Noneif there is no escrow on the trade.Warning
This isn’t likely to be accurate, use
User.escrow()instead if possible.- Type:
Optional[datetime.timedelta]
- await confirm()¶
Confirms the trade offer. This rarely needs to be called as the client handles most of these.
- Raises:
steam.ClientException – The trade is not active.
steam.ConfirmationError – No matching confirmation could not be found.
- await accept()¶
Accepts the trade offer.
Note
This also calls
confirm()(if necessary) so you don’t have to.- Raises:
steam.ClientException – The trade is either not active, already accepted or not from the ClientUser.
steam.ConfirmationError – No matching confirmation could not be found.
- await decline()¶
Declines the trade offer.
- Raises:
ClientException – The trade is either not active, already declined or not from the ClientUser.
- await cancel()¶
Cancels the trade offer.
- Raises:
ClientException – The trade is either not active or already cancelled.
- await receipt()¶
Get the receipt for a trade offer and the updated asset ids for the trade.
- Returns:
A trade receipt. .. source:: steam.TradeOfferReceipt
- Return type:
- await counter(trade)¶
Counter a trade offer from an
User.- Parameters:
trade (TradeOffer) – The trade offer to counter with.
- Raises:
ClientException – The trade from the ClientUser or it isn’t active.
- is_gift()¶
Helper method that checks if an offer is a gift to the
ClientUser- Return type:
- is_our_offer()¶
Whether the offer was created by the
ClientUser.- Return type:
Images¶
- class steam.Image(fp, *, spoiler=False)¶
A wrapper around common image files. Used for
steam.User.send().- Parameters:
Note
- Currently supported image types include:
PNG
JPG/JPEG
GIF
Exceptions¶
The following exceptions are thrown by the library.
- exception steam.SteamException¶
Base exception class for steam.py.
- exception steam.ClientException¶
Exception that’s thrown when something in the client fails.
Subclass of
SteamException.
- exception steam.LoginError¶
Exception that’s thrown when a login fails.
Subclass of
SteamException.
- exception steam.InvalidCredentials¶
Exception that’s thrown when credentials are incorrect.
Subclass of
LoginError.
- exception steam.NoCMsFound¶
Exception that’s thrown when no CMs can be found to connect to.
Subclass of
LoginError.
- exception steam.AuthenticatorError¶
Exception that’s thrown when Steam cannot authenticate your details.
Subclass of
LoginError.
- exception steam.ConfirmationError¶
Exception that’s thrown when a confirmation fails.
Subclass of
AuthenticatorError.
- exception steam.HTTPException(response, data)¶
Exception that’s thrown for any web API error.
Subclass of
SteamException.- response¶
The response of the failed HTTP request.
- message¶
The message associated with the error. Could be an empty string if no message can parsed.
- status¶
The status code of the HTTP request.
- code¶
The Steam specific error code for the failure.
- exception steam.Forbidden(response, data)¶
Exception that’s thrown when status code 403 occurs.
Subclass of
HTTPException.
- exception steam.NotFound(response, data)¶
Exception that’s thrown when status code 404 occurs.
Subclass of
HTTPException.
- exception steam.WSException(msg)¶
Exception that’s thrown for any websocket error. Similar to
HTTPException.Subclass of
SteamException.- msg¶
The received protobuf.
- message¶
The message that Steam sent back with the request, could be
None.
- code¶
The Steam specific error code for the failure.
- exception steam.WSForbidden(msg)¶
Exception that’s thrown when the websocket returns an
Resultthat means we do not have permission to perform an action. Similar toForbidden.Subclass of
WSException.
- exception steam.WSNotFound(msg)¶
Exception that’s thrown when the websocket returns an
Resultthat means the object wasn’t found. Similar toNotFound.Subclass of
WSException.
- exception steam.InvalidSteamID(id, msg=None)¶
Exception that’s thrown when a SteamID cannot be valid.
Subclass of
SteamException.- id¶
The invalid id.