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

class steam.Client(*, proxy: str | None = '...', proxy_auth: aiohttp.BasicAuth | None = '...', connector: aiohttp.BaseConnector | None = '...', max_messages: int | None = '...', game: Game | None = '...', games: list[steam.game.Game] = '...', state: PersonaState | None = '...', ui_mode: UIMode | None = '...', flags: PersonaStateFlag | None = '...', force_kick: bool = '...')

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 extension on_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 or not to forcefully kick any other playing sessions on connect. Defaults to False.

property user: ClientUser

Represents the connected client. None if not logged in.

property users: list[User]

A list of all the users the connected client can see.

property trades: list[TradeOffer]

A list of all the trades the connected client can see.

property groups: list[Group]

A list of all the groups the connected client is in.

property clans: list[Clan]

A list of all the clans the connected client is in.

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 to run() or start(), which blocks exiting until one is entered.

Return type

str

is_ready()

Specifies if the client’s internal cache is ready for use.

Return type

bool

is_closed()

Indicates if connection is closed to the API or CMs.

Return type

bool

@event(coro: None = None) collections.abc.Callable[steam.client.E, steam.client.E]
@event(coro: steam.client.E) steam.client.E

A decorator that could be called. Register an event to listen to.

The events must be a coroutine, if not, TypeError is 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, (~E,)], steam.client.E]

run(*args, **kwargs)

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().

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 (str | None) – The shared_secret of the desired Steam account, used to generate the 2FA code for login. If None is passed, the code will need to be inputted by the user via code().

Raises
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() and is_ready() both return False. This also clears the internal cache.

await start(username, password, *, shared_secret=None, identity_secret=None)

A shorthand coroutine for login() and connect().

If no shared_secret is passed, you will have to manually enter a Steam guard code using code().

Parameters
  • username (str) – The username of the account to login to.

  • password (str) – The password of the account to login to.

  • shared_secret (str | None) – The shared secret for the account to login to.

  • identity_secret (str | None) – The identity secret for the account to login to.

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 None if the user was not found.

Parameters

id (utils.Intable) – The ID of the user, can be an SteamID.id64, SteamID.id, SteamID.id2 or an SteamID.id3.

Return type

Optional[steam.user.User]

await fetch_user(id)

Fetches a user with a matching ID or None if the user was not found.

Parameters

id (utils.Intable) – The ID of the user, can be an SteamID.id64, SteamID.id, SteamID.id2 or an SteamID.id3.

Return type

Optional[steam.user.User]

await fetch_users(*ids)

Fetches a list of User or None if the user was not found, from their IDs.

Note

The User objects returned are unlikely to retain the order they were originally in.

Parameters

ids (utils.Intable) – The user’s IDs.

Return type

list[Optional[steam.user.User]]

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

Optional[steam.user.User]

get_trade(id)

Get a trade from cache with a matching ID or None if the trade was not found.

Parameters

id (int) – The id of the trade to search for from the cache.

Return type

Optional[steam.trade.TradeOffer]

await fetch_trade(id)

Fetches a trade with a matching ID or None if the trade was not found.

Parameters

id (int) – The ID of the trade to search for from the API.

Return type

Optional[steam.trade.TradeOffer]

get_group(id)

Get a group from cache with a matching ID or None if the group was not found.

Parameters

id (utils.Intable) – The ID of the group, can be an SteamID.id64, SteamID.id, SteamID.id2 or an SteamID.id3.

Return type

Optional[steam.group.Group]

get_clan(id)

Get a clan from cache with a matching ID or None if the group was not found.

Parameters

id (utils.Intable) – The ID of the clan, can be an SteamID.id64, SteamID.id, SteamID.id2 or an SteamID.id3.

Return type

Optional[steam.clan.Clan]

await fetch_clan(id)

Fetches a clan from the websocket with a matching ID or None if the clan was not found.

Parameters

id (utils.Intable) – The ID of the clan, can be an SteamID.id64, SteamID.id, SteamID.id2 or an SteamID.id3.

Return type

Optional[steam.clan.Clan]

await fetch_clan_named(name)

Fetches a clan from https://steamcommunity.com with a matching name or None if the clan was not found.

Parameters

name (str) – The name of the Steam clan.

Return type

Optional[steam.clan.Clan]

get_game(id)

Creates a stateful game from its ID.

Parameters

id (int | Game) – The app id of the game or a Game instance.

Return type

steam.game.StatefulGame

await fetch_game(id)

Fetch a game from its ID or None if the game was not found.

Parameters

id (int | Game) – The app id of the game or a Game instance.

Return type

Optional[steam.game.FetchedGame]

await fetch_server(*, id: utils.Intable) GameServer | None
await fetch_server(*, ip: str, port: int | None = None) GameServer | None

Fetch a GameServer from its ip and port or its SteamID or None if 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.id2 or an SteamID.id3. If this is passed, it makes a call to the master server to fetch its ip and port.

Note

Passing an ip, port and id to this function will raise an TypeError.

Return type

Optional[steam.game_server.GameServer]

await fetch_servers(query, limit=100)

Query game servers.

Parameters
  • query (steam.game_server.Query[Any]) – The query to match servers with.

  • limit (int) – The maximum amount of servers to return.

Return type

list[steam.game_server.GameServer]

trade_history(limit=100, before=None, after=None)

An AsyncIterator for accessing a steam.ClientUser’s steam.TradeOffer objects.

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 to None will fetch all of the user’s trades, but this will be a very slow operation.

  • before (datetime.datetime | None) – A time to search for trades before.

  • after (datetime.datetime | None) – A time to search for trades after.

Yields

TradeOffer

await change_presence(*, game=None, games=None, state=None, ui_mode=None, flags=None, force_kick=False)

Set your status.

Parameters
  • game (Game | None) – A games to set your status as.

  • games (list[Game] | None) – A list of games to set your status to.

  • state (PersonaState | None) –

    The state to show your account as.

    Warning

    Setting your status to Offline, will stop you receiving persona state updates and by extension on_user_update() will stop being dispatched.

  • ui_mode (UIMode | None) – The UI mode to set your status to.

  • flags (PersonaStateFlag | None) – The flags to update your account with.

  • force_kick (bool) – Whether or not to forcefully kick any other playing sessions.

await trade_url(generate_new=False)

Fetches this account’s trade url.

Parameters

generate_new (bool) – Whether or not to generate a new trade token, defaults to False.

Return type

str

await wait_until_ready()

Waits until the client’s internal cache is all ready.

await fetch_price(name, game, currency=None)

Fetch the PriceOverview for an item.

Parameters
  • name (str) – The name of the item.

  • game (Game) – The game the item is from.

  • currency (int | None) – The currency to fetch the price in.

Return type

steam.models.PriceOverview

await wait_for(event: Literal['connect', 'disconnect', 'ready', 'login', 'logout'], *, check: collections.abc.Callable[bool] = <return_true>, timeout: float | None = None) None
await wait_for(event: 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[typing.Any], dict[str, typing.Any]]
await wait_for(event: Literal['message'], *, check: Callable[[Message], bool] = <return_true>, timeout: float | None = None) Message
await wait_for(event: Literal['comment'], *, check: Callable[[Comment], bool] = <return_true>, timeout: float | None = None) Comment
await wait_for(event: Literal['user_update'], *, check: Callable[[User, User], bool] = <return_true>, timeout: float | None = None) tuple[User, User]
await wait_for(event: Literal['clan_update'], *, check: Callable[[Clan, Clan], bool] = <return_true>, timeout: float | None = None) tuple[Clan, Clan]
await wait_for(event: Literal['group_update'], *, check: Callable[[Group, Group], bool] = <return_true>, timeout: float | None = None) tuple[Group, Group]
await wait_for(event: Literal['typing'], *, check: Callable[[User, datetime.datetime], bool] = <return_true>, timeout: float | None = None) tuple[User, datetime.datetime]
await wait_for(event: 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: Literal['user_invite', 'user_invite_accept', 'user_invite_decline'], *, check: Callable[[UserInvite], bool] = <return_true>, timeout: float | None = None) UserInvite
await wait_for(event: Literal['user_remove'], *, check: Callable[[User], bool] = <return_true>, timeout: float | None = None) User
await wait_for(event: Literal['clan_invite', 'clan_invite_accept', 'clan_invite_decline'], *, check: Callable[[ClanInvite], bool] = <return_true>, timeout: float | None = None) ClanInvite
await wait_for(event: Literal['clan_join', 'clan_leave'], *, check: Callable[[Clan], bool] = <return_true>, timeout: float | None = None) Clan
await wait_for(event: Literal['group_join', 'group_leave'], *, check: Callable[[Group], bool] = <return_true>, timeout: float | None = None) Group
await wait_for(event: Literal['event_create'], *, check: Callable[[Event], bool] = <return_true>, timeout: float | None = None) Event
await wait_for(event: Literal['announcement_create'], *, check: Callable[[Announcement], bool] = <return_true>, timeout: float | None = None) Announcement
await wait_for(event: Literal['socket_receive', 'socket_send'], *, check: collections.abc.Callable[MsgProto[Any] | Msg[Any] | GCMsgProto[Any] | GCMsg[Any], 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 event being waited for and must return a bool.

  • timeout – By default, wait_for() function does not timeout, however, in the case a timeout parameter is passed after the amount of seconds pass asyncio.TimeoutError is raised.

Raises

asyncio.TimeoutError – If the provided timeout was reached.

Returns

Returns None, a single argument or a tuple of multiple arguments that mirrors the parameters for the event parameter from the event reference.

Return type

Any

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.stderr and 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 Client class you can define an on_error handler consisting of a single empty The raise statement. Exceptions raised by on_error will not be handled in any way by Client.

Parameters
  • event (str) – The name of the event that errored.

  • error (Exception) – The error that was raised.

  • args – The positional arguments associated with the event.

  • kwargs – The key-word arguments associated with the event.

Return type

Any

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
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 Canceled and CanceledBySecondaryFactor.

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 User to 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 User to 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 User to become a friend.

Parameters

invite (steam.UserInvite) – The invite that was declined.

await Client.on_user_remove(user)

Called when you or the user remove each other from your friends lists.

Parameters

user (steam.User) – The user who was removed.

await Client.on_clan_invite(invite)

Called when the client receives/sends an invite from/to a User to join a Clan.

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/MsgProto to 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

int

steam.utils.parse_trade_url(url)

Parses a trade URL for useful information.

Parameters

url (StrOrURL) – The trade URL to search.

Returns

A re.Match object with token and user_id re.Match.group() objects or None.

Return type

Optional[Match[str]]

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 for find().

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
Parameters
  • iterable (Iterable[_T]) – An iterable to search through.

  • attrs (Any) – Keyword arguments that denote attributes to match.

Returns

  • The first element from the iterable which matches all the traits passed in attrs or None if no matching

  • element was found.

Return type

_T | None

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
  • predicate (Callable[[_T], bool]) – A function that returns a boolean and takes an element from the iterable as its first argument.

  • iterable (Iterable[_T]) – The iterable to search through.

Returns

The first element from the iterable for which the predicate returns True or if no matching element was found returns None.

Return type

Optional[steam.utils._T]

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.

ServiceUnavailable = 20

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 users 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 login.

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.

ClientNoLongerSupported = 119

The specified launcher type is no longer supported.

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.

I = 0

The character used for Invalid.

U = 1

The character used for Individual.

M = 2

The character used for Multiseat.

G = 3

The character used for GameServer.

A = 4

The character used for AnonGameServer.

P = 5

The character used for Pending.

C = 6

The character used for ContentServer.

g = 7

The character used for Clan.

T = 8

The character used for Chat (Lobby/group chat).

L = 8

The character used for Chat (Lobby/group chat).

c = 7

The character used for Clan.

a = 10

The character used for Invalid.

class steam.InstanceFlag

An enumeration.

MMSLobby = 131072

The Steam ID is for a MMS Lobby.

Lobby = 262144

The Steam ID is for a Lobby.

Clan = 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 ignored the invite.

RequestRecipient = 2

The user has requested to be 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 = 256
ClientTypeMobile = 512
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.

property event_name: str | None
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.

Guard

steam.guard.generate_one_time_code(shared_secret, timestamp=None)

Generate a Steam Guard code for signing in or at a specific time.

Parameters
  • shared_secret (str) – Shared secret from steam guard.

  • timestamp (int | None) – The unix timestamp to generate the key for.

Return type

str

steam.guard.generate_confirmation_code(identity_secret, tag, timestamp=None)

Generate a trade confirmation code.

Parameters
  • identity_secret (str) – Identity secret from steam guard.

  • tag (str) – Tag to encode to.

  • timestamp (int | None) – The time to generate the key for.

Return type

str

steam.guard.generate_device_id(user_id64)

Generate the device id for a user’s 64 bit ID.

Parameters

user_id64 (Intable) – The 64 bit steam id to generate the device id for.

Return type

str

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

datetime.datetime

after

When to find objects after.

Type

datetime.datetime

limit

The maximum size of the queue.

Type

Optional[int]

queue

The queue containing the elements of the iterator.

Type

collections.deque[steam.iterators.T]

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")
Parameters

attrs (Any) – Keyword arguments that denote attributes to match.

Returns

The first element from the iterable which matches all the traits passed in attrs or None if no matching element was found.

Return type

Optional[steam.iterators.T]

await find(predicate)

A helper function which is similar to find() except it runs over the async iterator. However unlike find(), 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 predicate returns True or None if no matching element was found.

Return type

Optional[steam.iterators.T]

await flatten()

A helper function that iterates over the AsyncIterator returning 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.
Parameters

predicate (collections.abc.Callable[steam.iterators.T, bool]) – The predicate to filter elements through.

Return type

steam.iterators.FilteredIterator[steam.iterators.T]

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.
Parameters

func (collections.abc.Callable[steam.iterators.TT, Any]) – The function to map the elements through.

Return type

steam.iterators.MappedIterator[steam.iterators.T, steam.iterators.TT]

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.

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.

name

The user’s username.

Type

str

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 None if 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]

avatar_url

The avatar url of the user. Uses the large (184x184 px) image url.

Type

Optional[str]

real_name

The user’s real name defined by them. Could be None.

Type

Optional[str]

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]

country

The country code of the account. Could be None.

Type

Optional[str]

flags

The persona state flags of the account.

Type

Optional[steam.enums.PersonaStateFlag]

property mention: str

The string used to mention the user in chat.

await inventory(game)

Fetch a user’s Inventory for trading.

Parameters

game (steam.game.Game) – The game to fetch the inventory for.

Raises

Forbidden – The user’s inventory is private.

Return type

steam.trade.Inventory

await friends()

Fetch the list of the users friends.

Return type

list[steam.user.User]

await games()

Fetches the Games the user owns.

Return type

list[steam.game.UserGame]

await clans()

Fetches a list of Clans the user is in.

Return type

list[steam.clan.Clan]

await bans()

Fetches the user’s Bans.

Return type

steam.models.Ban

await badges()

Fetches the user’s UserBadgess.

Return type

steam.badge.UserBadges

await level()

Fetches the user’s level if your account is premium, otherwise it’s cached.

Return type

int

await wishlist()

Get the WishlistGames the user has on their wishlist.

Return type

list[steam.game.WishlistGame]

await favourite_badge()

The user’s favourite badge

Return type

Optional[steam.badge.FavouriteBadge]

await equipped_profile_items()

The user’s equipped profile items.

Return type

steam.profile.EquippedProfileItems

await profile_info()

The user’s profile info.

Return type

steam.profile.ProfileInfo

await profile()

Fetch a user’s entire profile information.

Note

This calls all the profile_x functions to return a Profile object which has all the info set.

Return type

steam.profile.Profile

is_commentable()

Specifies if the user’s account is able to be commented on.

Return type

bool

is_private()

Specifies if the user has a private profile.

Return type

bool

has_setup_profile()

Specifies if the user has a setup their profile.

Return type

bool

await is_banned()

Specifies if the user is banned from any part of Steam.

This is equivalent to:

bans = await user.bans()
bans.is_banned()
Return type

bool

await comment(content, *, subscribe=True)

Post a comment to a comments section.

Parameters
  • content (str) – The message to add to the comment section.

  • subscribe (bool) – WWhether or not to subscribe to notifications on any future activity in this comment’s thread.

Returns

The created comment.

Return type

steam.comment.Comment[Any]

comments(oldest_first=False, limit=None, before=None, after=None)

An AsyncIterator for accessing a comment section’s Comment objects.

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 None which will fetch the clan’s entire comments section.

  • before (datetime | None) – A time to search for comments before.

  • after (datetime | None) – A time to search for comments after.

Yields

Comment

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

Optional[steam.abc.SteamID]

property id: int

The SteamID’s 32 bit ID.

property id2: str

The SteamID’s ID 2.

e.g STEAM_1:0:1234.

property id2_zero: str

The SteamID’s ID 2 accounted for bugged GoldSrc and Orange Box games.

Note

In these games the accounts universe, 1 for Type.Public, should be the X component of STEAM_X:0:1234 however, this was bugged and the value of X was 0.

e.g STEAM_0:0:1234.

property id3: str

The SteamID’s ID 3.

e.g [U:1:1234].

property id64: int

The SteamID’s 64 bit ID.

property instance: int

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.

property invite_url: str | None

The SteamID’s full invite code URL.

e.g https://s.team/p/cv-dgb.

is_valid()

Whether or not the SteamID is valid.

Return type

bool

property type: steam.enums.Type

The Steam type of the SteamID.

property universe: steam.enums.Universe

The Steam universe of the SteamID.

Methods
class steam.abc.Channel
abstractmethod history(limit=100, before=None, after=None)

An AsyncIterator for accessing a channel’s steam.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 None will fetch all of the channel’s messages, but this will be a very slow operation.

  • before (datetime | None) – A time to search for messages before.

  • after (datetime | None) – A time to search for messages after.

Yields

Message

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 content is implicitly cast to a str.

Raises
Returns

The sent message, only applicable if content is passed.

Return type

Optional[steam.abc.M_co]

Methods
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
  • content (Optional[Any]) – The content of the message to send.

  • image (Optional[steam.image.Image]) – The image to send to the user.

Note

Anything as passed to content is implicitly cast to a str.

Raises
Returns

The sent message, only applicable if content is 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.

Badge

class steam.Badge

Represents a Steam badge.

id

The badge’s ID.

Type

int

level

The badge’s level.

Type

int

game

The game associated with the badge.

Type

Optional[steam.game.StatefulGame]

xp

The badge’s XP.

Type

int

completion_time

The time the badge was completed at.

Type

datetime.datetime

scarcity

The scarcity of the badge.

Type

int

class steam.UserBadges

Represents a Steam User’s badges/level.

level

The badge’s level.

Type

int

xp

The badge’s XP.

Type

int

xp_needed_to_level_up

The amount of XP the user needs to level up.

Type

int

xp_needed_for_current_level

The amount of XP the user’s current level requires to achieve.

Type

int

badges

A list of the user’s badges.

Type

Sequence[steam.Badge]

class steam.FavouriteBadge

Represents a User’s favourite badge.

id

The badge’s ID.

Type

int

level

The badge’s level.

Type

int

game

The game associated with the badge.

Type

Optional[steam.game.StatefulGame]

item_id

The badge’s item’s ID.

Type

int

type

The badge’s type.

Type

int

border_colour

The colour of the boarder of the badge.

Type

int

Ban

class steam.Ban

Represents a Steam ban.

since_last_ban

How many days since the user was last banned

Type

datetime.timedelta

number_of_game_bans

The number of game bans the user has.

Type

int

is_banned()

Species if the user is banned from any part of Steam.

Return type

bool

is_vac_banned()

Whether or not the user is VAC banned.

Return type

bool

is_community_banned()

Whether or not the user is community banned.

Return type

bool

is_market_banned()

Whether or not the user is market banned.

Return type

bool

Channel

Attributes
Methods
class steam.DMChannel

Represents the channel a DM is sent in.

participant

The recipient of any messages sent.

Type

steam.user.User

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 ctx.channel.typing():
    ...  # do your expensive operations
Return type

AsyncContextManager

await trigger_typing()

Send a typing indicator to the channel once.

Note

This only works in DMs.

history(limit=100, before=None, after=None)

An AsyncIterator for accessing a channel’s steam.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 None will fetch all of the channel’s messages, but this will be a very slow operation.

  • before (datetime | None) – A time to search for messages before.

  • after (datetime | None) – A time to search for messages after.

Yields

Message

await send(content=None, image=None)

Send a message to a certain destination.

Parameters
  • content (Optional[Any]) – The content of the message to send.

  • image (Optional[steam.image.Image]) – The image to send to the user.

Note

Anything as passed to content is implicitly cast to a str.

Raises
Returns

The sent message, only applicable if content is passed.

Return type

Optional[steam.abc.M_co]

Methods
class steam.GroupChannel

Represents a group channel.

id

The ID of the channel.

Type

int

name

The name of the channel, this could be the same as the name if 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]

position

The position of the channel in the channel list.

Type

Optional[int]

last_message

The last message sent in the channel.

Type

Optional[steam.abc.M_co]

history(limit=100, before=None, after=None)

An AsyncIterator for accessing a channel’s steam.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 None will fetch all of the channel’s messages, but this will be a very slow operation.

  • before (datetime | None) – A time to search for messages before.

  • after (datetime | None) – A time to search for messages after.

Yields

Message

await send(content=None, image=None)

Send a message to a certain destination.

Parameters
  • content (Optional[Any]) – The content of the message to send.

  • image (Optional[steam.image.Image]) – The image to send to the user.

Note

Anything as passed to content is implicitly cast to a str.

Raises
Returns

The sent message, only applicable if content is passed.

Return type

Optional[steam.abc.M_co]

Methods
class steam.ClanChannel

Represents a group channel.

id

The ID of the channel.

Type

int

name

The name of the channel, this could be the same as the name if 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]

position

The position of the channel in the channel list.

Type

Optional[int]

last_message

The last message sent in the channel.

Type

Optional[steam.abc.M_co]

history(limit=100, before=None, after=None)

An AsyncIterator for accessing a channel’s steam.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 (Optional[int]) – The maximum number of messages to search through. Setting this to None will fetch all of the channel’s messages, but this will be a very slow operation.

  • before (Optional[datetime.datetime]) – A time to search for messages before.

  • after (Optional[datetime.datetime]) – A time to search for messages after.

Yields

Message

await send(content=None, image=None)

Send a message to a certain destination.

Parameters
  • content (Optional[Any]) – The content of the message to send.

  • image (Optional[steam.image.Image]) – The image to send to the user.

Note

Anything as passed to content is implicitly cast to a str.

Raises
Returns

The sent message, only applicable if content is passed.

Return type

Optional[steam.abc.M_co]

Clan

class steam.Clan

Represents a Steam clan.

x == y

Checks if two clans are equal.

str(x)

Returns the clan’s name.

name

The name of the clan.

Type

str

chat_id

The clan’s chat id, this is different to id.

Type

Optional[int]

avatar_url

The icon url of the clan. Uses the large (184x184 px) image url.

Type

Optional[str]

content

The content of the clan.

Type

str

tagline

The clan’s tagline.

Type

Optional[str]

member_count

The amount of users in the clan.

Type

int

online_count

The amount of users currently online.

Type

int

active_member_count

The amount of currently users in the clan’s chat room.

Type

Optional[int]

in_game_count

The amount of user’s currently in game.

Type

int

created_at

The time the clan was created_at.

Type

Optional[datetime.datetime]

language

The language set for the clan.

Type

str

location

The location set for the clan.

Type

str

game

The clan’s associated game.

Type

Optional[steam.game.StatefulGame]

owner

The clan’s owner.

Type

Optional[steam.user.User]

admins

A list of the clan’s administrators.

Type

list[steam.user.User]

mods

A list of the clan’s moderators.

Type

list[steam.user.User]

top_members

A list of the clan’s top_members.

Type

list[typing.Optional[steam.user.User]]

roles

A list of the clan’s roles.

Type

list[steam.role.Role]

default_role

The clan’s default role.

Type

Optional[steam.role.Role]

property channels: list[steam.ClanChannel]

A list of the clan’s channels.

property default_channel: ClanChannel | None

The clan’s default channel.

get_channel(id)

Get a channel from cache.

Parameters

id (int) – The id of the channel.

Return type

Optional[steam.ClanChannel]

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

list[steam.abc.SteamID]

property description: str

An alias to content.

Deprecated since version 0.8.0: Use content instead.

property icon_url: str

An alias to avatar_url.

Deprecated since version 0.8.0: Use avatar_url instead.

await join()

Joins the clan. This will also join the clan’s chat.

await leave()

Leaves the clan.

await invite(user)

Invites a User to the clan.

Parameters

user (User) – The user to invite to the clan.

await fetch_event(id)

Fetch an event from its ID.

Parameters

id (int) – The ID of the event.

Return type

steam.event.Event

await fetch_announcement(id)

Fetch an announcement from its ID.

Parameters

id (int) – The ID of the announcement.

Return type

steam.event.Announcement

events(limit=100, before=None, after=None)

An AsyncIterator over a clan’s steam.Events.

Examples

Usage:

async for event in client.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 to None will fetch all of the clan’s events, but this will be a very slow operation.

  • before (datetime | None) – A time to search for events before.

  • after (datetime | None) – A time to search for events after.

Yields

Event

announcements(limit=100, before=None, after=None)

An AsyncIterator over a clan’s steam.Announcements.

Examples

Usage:

async for announcement in client.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 to None will fetch all of the clan’s announcements, but this will be a very slow operation.

  • before (datetime | None) – A time to search for announcements before.

  • after (datetime | None) – A time to search for announcements after.

Yields

Announcement

await comment(content, *, subscribe=True)

Post a comment to a comments section.

Parameters
  • content (str) – The message to add to the comment section.

  • subscribe (bool) – WWhether or not to subscribe to notifications on any future activity in this comment’s thread.

Returns

The created comment.

Return type

steam.comment.Comment[Any]

comments(oldest_first=False, limit=None, before=None, after=None)

An AsyncIterator for accessing a comment section’s Comment objects.

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 None which will fetch the clan’s entire comments section.

  • before (Optional[datetime.datetime]) – A time to search for comments before.

  • after (Optional[datetime.datetime]) – A time to search for comments after.

Yields

Comment

await create_event(name: str, content: str, *, type: Literal[<ClanEvent.Other: 1>, <ClanEvent.Chat: 9>, <ClanEvent.Party: 3>, <ClanEvent.Meeting: 4>, <ClanEvent.SpecialCause: 5>, <ClanEvent.MusicAndArts: 6>, <ClanEvent.Sports: 7>, <ClanEvent.Trip: 8>] = 'ClanEvent.Other', starts_at: datetime | None = 'None') steam.event.Event
await create_event(name: str, content: str, *, game: steam.game.Game, type: Literal[<ClanEvent.Game: 2>] = ClanEvent.Other, starts_at: datetime | None = None, server_address: str | None = None, server_password: str | None = None) steam.event.Event

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 type is ClanEvent.Game.

  • server_password – The password for the server that the event will be played on. This is only allowed if type is ClanEvent.Game.

Note

It is recommended to use a timezone aware datetime for start.

Returns

The created event.

Return type

steam.event.Event

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

Optional[steam.abc.SteamID]

property id: int

The SteamID’s 32 bit ID.

property id2: str

The SteamID’s ID 2.

e.g STEAM_1:0:1234.

property id2_zero: str

The SteamID’s ID 2 accounted for bugged GoldSrc and Orange Box games.

Note

In these games the accounts universe, 1 for Type.Public, should be the X component of STEAM_X:0:1234 however, this was bugged and the value of X was 0.

e.g STEAM_0:0:1234.

property id3: str

The SteamID’s ID 3.

e.g [U:1:1234].

property id64: int

The SteamID’s 64 bit ID.

property instance: int

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.

property invite_url: str | None

The SteamID’s full invite code URL.

e.g https://s.team/p/cv-dgb.

is_valid()

Whether or not the SteamID is valid.

Return type

bool

property type: steam.enums.Type

The Steam type of the SteamID.

property universe: steam.enums.Universe

The Steam universe of the SteamID.

await create_announcement(name, content, hidden=False)

Create an announcement.

Parameters
  • name (str) – The name of the announcement.

  • content (str) – The content of the announcement.

  • hidden (bool) – Whether or not the announcement should initially be hidden.

Returns

The created announcement.

Return type

steam.event.Announcement

Comment

Methods
class steam.Comment

Represents a comment on a Steam profile.

id

The comment’s id.

Type

int

content

The comment’s content.

Type

str

author

The author of the comment.

Type

Union[steam.user.User, steam.user.ClientUser]

created_at

The time the comment was posted at.

Type

datetime.datetime

owner

The comment sections owner.

Type

steam.comment.C

await report()

Reports the comment.

await delete()

Deletes the comment.

Game Servers

class steam.GameServer

Represents a game server.

name

The name of the server.

Type

str

game

The game of the server.

Type

steam.game.StatefulGame

ip

The ip of the server.

Type

str

port

The port of the server.

Type

int

tags

The tags of the server.

Type

list[str]

map

The map the server is running.

Type

str

bot_count

The number of bots in the server.

Type

int

player_count

The number of players the server.

Type

int

max_player_count

The maximum player count of the server.

Type

int

region

The region the server is in.

Type

Any

version

The version of the server.

Type

str

is_secure()

Whether the sever is secured, likely with VAC.

Return type

bool

is_dedicated()

Whether the sever is dedicated.

Return type

bool

await players(*, challenge=0)

Fetch a server’s players or None if something went wrong getting the info.

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.

Note

It is recommended to use asyncio.wait_for() to allow this to return if the server doesn’t respond.

Returns ServerPlayer is a typing.NamedTuple defined as:

class ServerPlayer(NamedTuple):
    index: int
    name: str
    score: int
    play_time: timedelta
Return type

Optional[list[tuple[int, str, int, datetime.timedelta]]]

await rules(*, challenge=0)

Fetch a console variables. e.g. sv_gravity or sv_voiceenable.

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.

Note

It is recommended to use asyncio.wait_for() to allow this to return if the server doesn’t respond.

Return type

Optional[dict[str, str]]

property community_url: str | None

The SteamID’s community url.

e.g https://steamcommunity.com/profiles/123456789.

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

Optional[steam.abc.SteamID]

property id: int

The SteamID’s 32 bit ID.

property id2: str

The SteamID’s ID 2.

e.g STEAM_1:0:1234.

property id2_zero: str

The SteamID’s ID 2 accounted for bugged GoldSrc and Orange Box games.

Note

In these games the accounts universe, 1 for Type.Public, should be the X component of STEAM_X:0:1234 however, this was bugged and the value of X was 0.

e.g STEAM_0:0:1234.

property id3: str

The SteamID’s ID 3.

e.g [U:1:1234].

property id64: int

The SteamID’s 64 bit ID.

property instance: int

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.

property invite_url: str | None

The SteamID’s full invite code URL.

e.g https://s.team/p/cv-dgb.

is_valid()

Whether or not the SteamID is valid.

Return type

bool

property type: steam.enums.Type

The Steam type of the SteamID.

property universe: steam.enums.Universe

The Steam universe of the SteamID.

class steam.Query

A pathlib.Path like 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

>>> Query.running / TF2 / Query.not_empty / Query.secure
<Query query='\\appid\\440\\empty\\1\\secure\\1'>
# matches games running TF2, that are not empty and are using VAC
>>> Query.not_empty / Query.not_full | Query.secure
<Query query='\\empty\\1\\nor\\[\\full\\1\\secure\\1]'>
# matches games that are not empty, not full and are using VAC
>>> 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]]'>
# matches games where the server name is not "A cool Server" or the server doesn't support alltalk or increased
# max players
>>> Query.linux & Query.no_password
# matches games where the server is not on linux and the server doesn't have no password (has a password)
property query: str

The actual query used for querying Global Master Servers.

class property all: steam.game_server.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.

class property linux: Q

Fetches servers running on a Linux platform.

class property match_any_hidden_tags: Query[list[str]]

Fetches servers with any of the given tag(s) in their ‘hidden’ tags only applies for steam.LFD2.

class property match_hidden_tags: Query[list[str]]

Fetches servers with all of the given tag(s) in their ‘hidden’ tags only applies for steam.LFD2.

class property match_tags: Query[list[str]]

Fetches servers with all of 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 not_running: Query[Game | int]

Fetches servers not running a Game or an int app id.

class property proxy: Q

Fetches servers that are spectator proxies.

class property running: Query[Game | int]

Fetches servers running a Game or an int app id.

class property running_map: Query[str]

Fetches servers running the specified map (e.g. cs_italy)

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 version_match: Query[str]

Fetches servers running version “x” ("*" is wildcard).

class property whitelisted: Q

Fetches servers that are whitelisted.

Group

class steam.Group

Represents a Steam group.

name

The name of the group, could be None.

Type

str

owner

The owner of the group.

Type

Union[steam.user.User, steam.abc.SteamID]

members

A list of the group’s members.

Type

list[steam.user.User]

active_member_count

The group’s active member count.

Type

int

roles

A list of the group’s roles.

Type

list[steam.role.Role]

default_role

The group’s default role.

Type

Optional[steam.role.Role]

default_channel

The group’s default channel.

Type

steam.GroupChannel

property channels: list[steam.GroupChannel]

A list of the group’s channels.

property top_members: list[User | None]

A list of the group’s top members according to Steam.

await leave()

Leaves the group.

await invite(user)

Invites a User to the group.

Parameters

user (User) – The user to invite to the group.

property community_url: str | None

The SteamID’s community url.

e.g https://steamcommunity.com/profiles/123456789.

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

Optional[steam.abc.SteamID]

property id: int

The SteamID’s 32 bit ID.

property id2: str

The SteamID’s ID 2.

e.g STEAM_1:0:1234.

property id2_zero: str

The SteamID’s ID 2 accounted for bugged GoldSrc and Orange Box games.

Note

In these games the accounts universe, 1 for Type.Public, should be the X component of STEAM_X:0:1234 however, this was bugged and the value of X was 0.

e.g STEAM_0:0:1234.

property id3: str

The SteamID’s ID 3.

e.g [U:1:1234].

property id64: int

The SteamID’s 64 bit ID.

property instance: int

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.

property invite_url: str | None

The SteamID’s full invite code URL.

e.g https://s.team/p/cv-dgb.

is_valid()

Whether or not the SteamID is valid.

Return type

bool

property type: steam.enums.Type

The Steam type of the SteamID.

property universe: steam.enums.Universe

The Steam universe of the SteamID.

Invite

Attributes
Methods
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. This None if the invite was sent while the bot is online.

Type

Optional[steam.enums.FriendRelationship]

await accept()

Accept the invite request.

await decline()

Decline the invite request.

Methods
class steam.ClanInvite

Represents a invite to join a Clan from 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.

Message

class steam.Message

Represents a message from a User. This is a base class from which all messages inherit.

The following classes implement this:

channel

The channel the message was sent in.

Type

steam.abc.Channel[steam.abc.Message]

content

The message’s content.

Note

This is not what you will see in the steam client see clean_content for that.

Type

str

clean_content

The message’s clean content without bbcode.

Type

str

author

The message’s author.

Type

Authors

created_at

The time the message was sent at.

Type

datetime.datetime

group

The group the message was sent in. Will be None if the message wasn’t sent in a Group.

Type

Optional[steam.Group]

clan

The clan the message was sent in. Will be None if the message wasn’t sent in a Clan.

Type

Optional[steam.Clan]

id

A unique identifier for every message sent in a channel.

Attributes
class steam.UserMessage

Represents a message from a user.

id

A unique identifier for every message sent in a channel.

Attributes
class steam.GroupMessage

Represents a message in a group.

id

A unique identifier for every message sent in a channel.

Attributes
class steam.ClanMessage

Represents a message in a clan.

id

A unique identifier for every message sent in a channel.

PriceOverview

class steam.PriceOverview

Represents the data received from https://steamcommunity.com/market/priceoverview.

currency

The currency identifier for the item e.g. “$” or “£”.

Type

str

volume

The amount of items are currently on the market.

Type

int

lowest_price

The lowest price observed by the market.

Type

Union[float, str]

median_price

The median price observed by the market.

Type

Union[float, str]

Profile

class steam.ProfileInfo

Represents the user’s profile info.

created_at

The time at which the user was created at.

Type

datetime.datetime

real_name

The real name of the user.

Type

Optional[str]

city_name

The city the user is located in.

Type

Optional[str]

state_name

The name of the state the user is located in.

Type

Optional[str]

country_name

The name of the country the user is located in.

Type

Optional[str]

headline

The profile’s headline.

Type

Optional[str]

summary

The user’s summary.

Type

str

class steam.ProfileItem

Represents an item on/in a user’s profile.

id

The item’s id.

Type

int

url

The item’s url.

Type

str

name

The item’s name.

Type

str

title

The item’s title.

Type

str

description

The item’s description.

Type

str

game

The game the item is from.

Type

steam.game.StatefulGame

type

The item’s type.

Type

Any

class_

The item’s class.

Type

int

movie

The movie associated with the item.

Type

steam.profile.ProfileMovie

equipped_flags

The item’s equipped flags.

Type

int

await equip()

Equip the profile item.

class steam.OwnedProfileItems

Represents the ClientUser's owned items.

backgrounds

The backgrounds the client user owns.

Type

list[steam.ProfileItem]

mini_profile_backgrounds

The mini profile backgrounds the client user owns.

Type

list[steam.ProfileItem]

avatar_frames

The avatar frames the client user owns.

Type

list[steam.ProfileItem]

animated_avatars

The animated avatars the client user owns.

Type

list[steam.ProfileItem]

modifiers

The modifiers the client user owns.

Type

list[steam.ProfileItem]

class steam.EquippedProfileItems

Represents the items the user has equipped.

background

The equipped background.

Type

Optional[steam.ProfileItem]

mini_profile_background

The equipped mini profile background for the user.

Type

Optional[steam.ProfileItem]

avatar_frame

The equipped avatar frame for the user.

Type

Optional[steam.ProfileItem]

animated_avatar

The equipped animated avatar for the user.

Type

Optional[steam.ProfileItem]

modifier

The equipped modifier for the user.

Type

Optional[steam.ProfileItem]

class steam.Profile

Represents a user’s complete profile.

background

The equipped background.

Type

Optional[steam.ProfileItem]

mini_profile_background

The equipped mini profile background for the user.

Type

Optional[steam.ProfileItem]

avatar_frame

The equipped avatar frame for the user.

Type

Optional[steam.ProfileItem]

animated_avatar

The equipped animated avatar for the user.

Type

Optional[steam.ProfileItem]

modifier

The equipped modifier for the user.

Type

Optional[steam.ProfileItem]

items

The account’s owned profile items.

Note

This is only available for the ClientUser's profile otherwise it is None.

Type

Optional[steam.OwnedProfileItems]

Trading

Attributes
Methods
class steam.Inventory

Represents a User’s inventory.

len(x)

Returns how many items are in the inventory.

iter(x)

Iterates over the inventory’s items.

y in x

Determines if an item is in the inventory based off of its class_id and instance_id.

items

A list of the inventory’s items.

Type

Sequence[steam.trade.I]

owner

The owner of the inventory.

Type

steam.abc.BaseUser

game

The game the inventory the game belongs to.

Type

steam.game.StatefulGame

filter_items(*names, limit=None)

A helper function that filters items by name from the inventory.

Parameters
  • names (str) – The names of the items to filter for.

  • limit (int | None) – The maximum amount of items to return. Checks from the front of the items.

Raises

ValueError – You passed a limit and multiple item names.

Returns

The matching items.

Return type

list[steam.trade.I]

get_item(name)

A helper function that gets an item or None if no matching item is found by name from the inventory.

Parameters

name (str) – The item to get from the inventory.

Return type

Optional[steam.trade.I]

await update()

Re-fetches the inventory.

class steam.Item

Represents an item in an User’s inventory.

x == y

Checks if two items are equal.

name

The market_name of the item.

Type

Optional[str]

display_name

The displayed name of the item. This could be different to Item.name if the item is user re-nameable.

Type

Optional[str]

colour

The colour of the item.

Type

Optional[int]

descriptions

The descriptions of the item.

Type

Optional[dict[str, str]]

type

The type of the item.

Type

Optional[str]

tags

The tags of the item.

Type

Optional[list[dict[str, str]]]

icon_url

The icon_url of the item. Uses the large (184x184 px) image url.

Type

Optional[str]

is_tradable()

Whether the item is tradable.

Return type

bool

is_marketable()

Whether the item is marketable.

Return type

bool

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.

game

The game the item is from.

Type

steam.game.Game

asset_id

The assetid of the item.

Type

int

amount

The amount of the same asset there are in the inventory.

Type

int

instance_id

The instanceid of the item.

Type

int

class_id

The classid of the item.

Type

int

Users

class steam.ClientUser

Represents your account.

x == y

Checks if two users are equal.

str(x)

Returns the user’s name.

name

The user’s username.

Type

str

friends

A list of the ClientUser’s friends.

Type

list[steam.user.User]

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 None if the user isn’t in a game or one that is recognised by the api.

Type

steam.game.StatefulGame

avatar_url

The avatar url of the user. Uses the large (184x184 px) image url.

Type

Optional[str]

real_name

The user’s real name defined by them. Could be None.

Type

Optional[str]

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 None if 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 None if user hasn’t been updated from the websocket.

Type

Optional[datetime.datetime]

country

The country code of the account. Could be None.

Type

Optional[str]

flags

The persona state flags of the account.

Type

Optional[steam.enums.PersonaStateFlag]

await setup_profile()

Set up your profile if possible.

await clear_nicks()

Clears the client user’s nickname/alias history.

await profile_items()

Fetch all of the client user’s profile items.

Return type

steam.OwnedProfileItems

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

steam.UserBadges

await bans()

Fetches the user’s Bans.

Return type

steam.Ban

await clans()

Fetches a list of Clans the user is in.

Return type

list[steam.Clan]

await comment(content, *, subscribe=True)

Post a comment to a comments section.

Parameters
  • content (str) – The message to add to the comment section.

  • subscribe (bool) – WWhether or not to subscribe to notifications on any future activity in this comment’s thread.

Returns

The created comment.

Return type

steam.Comment[Any]

comments(oldest_first=False, limit=None, before=None, after=None)

An AsyncIterator for accessing a comment section’s Comment objects.

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 None which will fetch the clan’s entire comments section.

  • before (Optional[datetime.datetime]) – A time to search for comments before.

  • after (Optional[datetime.datetime]) – A time to search for comments after.

Yields

Comment

community_url: Optional[str]
await equipped_profile_items()

The user’s equipped profile items.

Return type

steam.EquippedProfileItems

await favourite_badge()

The user’s favourite badge

Return type

Optional[steam.FavouriteBadge]

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

Optional[steam.abc.SteamID]

await games()

Fetches the Games the user owns.

Return type

list[steam.game.UserGame]

has_setup_profile()

Specifies if the user has a setup their profile.

Return type

bool

property id: int

The SteamID’s 32 bit ID.

property id2: str

The SteamID’s ID 2.

e.g STEAM_1:0:1234.

property id2_zero: str

The SteamID’s ID 2 accounted for bugged GoldSrc and Orange Box games.

Note

In these games the accounts universe, 1 for Type.Public, should be the X component of STEAM_X:0:1234 however, this was bugged and the value of X was 0.

e.g STEAM_0:0:1234.

property id3: str

The SteamID’s ID 3.

e.g [U:1:1234].

property id64: int

The SteamID’s 64 bit ID.

property instance: int

The instance of the SteamID.

await inventory(game)

Fetch a user’s Inventory for trading.

Parameters

game (steam.game.Game) – The game to fetch the inventory for.

Raises

Forbidden – The user’s inventory is private.

Return type

steam.Inventory

property invite_code: str | None

The SteamID’s invite code in the s.team invite code format.

e.g. cv-dgb.

property invite_url: str | None

The SteamID’s full invite code URL.

e.g https://s.team/p/cv-dgb.

await is_banned()

Specifies if the user is banned from any part of Steam.

This is equivalent to:

bans = await user.bans()
bans.is_banned()
Return type

bool

is_commentable()

Specifies if the user’s account is able to be commented on.

Return type

bool

is_private()

Specifies if the user has a private profile.

Return type

bool

is_valid()

Whether or not the SteamID is valid.

Return type

bool

await level()

Fetches the user’s level if your account is premium, otherwise it’s cached.

Return type

int

property mention: str

The string used to mention the user in chat.

await profile()

Fetch a user’s entire profile information.

Note

This calls all the profile_x functions to return a Profile object which has all the info set.

Return type

steam.Profile

await profile_info()

The user’s profile info.

Return type

steam.ProfileInfo

property type: steam.enums.Type

The Steam type of the SteamID.

property universe: steam.enums.Universe

The Steam universe of the SteamID.

await wishlist()

Get the WishlistGames the user has on their wishlist.

Return type

list[steam.game.WishlistGame]

class steam.User

Represents a Steam user’s account.

x == y

Checks if two users are equal.

str(x)

Returns the user’s name.

name

The user’s username.

Type

str

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 None if the user isn’t in a game or one that is recognised by the api.

Type

steam.game.StatefulGame

avatar_url

The avatar url of the user. Uses the large (184x184 px) image url.

Type

Optional[str]

real_name

The user’s real name defined by them. Could be None.

Type

Optional[str]

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 None if 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 None if user hasn’t been updated from the websocket.

Type

Optional[datetime.datetime]

country

The country code of the account. Could be None.

Type

Optional[str]

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 invite 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. None if the user has no escrow or has a private inventory.

Parameters

token (str | None) – The user’s trade offer token, not required if you are friends with the user.

Return type

Optional[datetime.timedelta]

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 id attribute updated after being sent.

  • image (Image | None) – The image to send to the user.

Raises
Returns

The sent message only applicable if content is passed.

Return type

Optional[steam.UserMessage]

await invite_to_group(group)

Invites the user to a Group.

Parameters

group (Group) – The group to invite the user to.

await invite_to_clan(clan)

Invites the user to a Clan.

Parameters

clan (Clan) – The clan to invite the user to.

await owns(game)

Whether or not the game is owned by this user.

Parameters

game (Game) – The game you want to check the ownership of.

Return type

bool

is_friend()

Whether or not the user is in the ClientUser’s friends.

Return type

bool

await badges()

Fetches the user’s UserBadgess.

Return type

steam.UserBadges

await bans()

Fetches the user’s Bans.

Return type

steam.Ban

await clans()

Fetches a list of Clans the user is in.

Return type

list[steam.Clan]

await comment(content, *, subscribe=True)

Post a comment to a comments section.

Parameters
  • content (str) – The message to add to the comment section.

  • subscribe (bool) – WWhether or not to subscribe to notifications on any future activity in this comment’s thread.

Returns

The created comment.

Return type

steam.Comment[Any]

comments(oldest_first=False, limit=None, before=None, after=None)

An AsyncIterator for accessing a comment section’s Comment objects.

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 None which will fetch the clan’s entire comments section.

  • before (Optional[datetime.datetime]) – A time to search for comments before.

  • after (Optional[datetime.datetime]) – A time to search for comments after.

Yields

Comment

community_url: Optional[str]
await equipped_profile_items()

The user’s equipped profile items.

Return type

steam.EquippedProfileItems

await favourite_badge()

The user’s favourite badge

Return type

Optional[steam.FavouriteBadge]

await friends()

Fetch the list of the users friends.

Return type

list[steam.User]

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

Optional[steam.abc.SteamID]

await games()

Fetches the Games the user owns.

Return type

list[steam.game.UserGame]

has_setup_profile()

Specifies if the user has a setup their profile.

Return type

bool

property id: int

The SteamID’s 32 bit ID.

property id2: str

The SteamID’s ID 2.

e.g STEAM_1:0:1234.

property id2_zero: str

The SteamID’s ID 2 accounted for bugged GoldSrc and Orange Box games.

Note

In these games the accounts universe, 1 for Type.Public, should be the X component of STEAM_X:0:1234 however, this was bugged and the value of X was 0.

e.g STEAM_0:0:1234.

property id3: str

The SteamID’s ID 3.

e.g [U:1:1234].

property id64: int

The SteamID’s 64 bit ID.

property instance: int

The instance of the SteamID.

await inventory(game)

Fetch a user’s Inventory for trading.

Parameters

game (steam.game.Game) – The game to fetch the inventory for.

Raises

Forbidden – The user’s inventory is private.

Return type

steam.Inventory

property invite_code: str | None

The SteamID’s invite code in the s.team invite code format.

e.g. cv-dgb.

property invite_url: str | None

The SteamID’s full invite code URL.

e.g https://s.team/p/cv-dgb.

await is_banned()

Specifies if the user is banned from any part of Steam.

This is equivalent to:

bans = await user.bans()
bans.is_banned()
Return type

bool

is_commentable()

Specifies if the user’s account is able to be commented on.

Return type

bool

is_private()

Specifies if the user has a private profile.

Return type

bool

is_valid()

Whether or not the SteamID is valid.

Return type

bool

await level()

Fetches the user’s level if your account is premium, otherwise it’s cached.

Return type

int

property mention: str

The string used to mention the user in chat.

await profile()

Fetch a user’s entire profile information.

Note

This calls all the profile_x functions to return a Profile object which has all the info set.

Return type

steam.Profile

await profile_info()

The user’s profile info.

Return type

steam.ProfileInfo

property type: steam.enums.Type

The Steam type of the SteamID.

property universe: steam.enums.Universe

The Steam universe of the SteamID.

await wishlist()

Get the WishlistGames the user has on their wishlist.

Return type

list[steam.game.WishlistGame]

Data-Classes

There are a few classes that can be constructed by the user, these include.

Game

Attributes
Methods
class steam.Game(*, id: Intable, name: str | None = '...', context_id: int | None = '...')
class steam.Game(*, name: Literal['Team Fortress 2'], id: Intable = '...', context_id: int | None = '...')
class steam.Game(*, name: Literal['Left 4 Dead 2'], id: Intable = '...', context_id: int | None = '...')
class steam.Game(*, name: Literal['DOTA 2'], id: Intable = '...', context_id: int | None = '...')
class steam.Game(*, name: Literal['Counter Strike Global-Offensive'], id: Intable = '...', context_id: int | None = '...')
class steam.Game(*, name: Literal['Steam'], id: Intable = '...', context_id: int | None = '...')

Represents a Steam game.

name

The game’s name.

id

The game’s app ID.

context_id

The context id of the game normally 2.

property title: str | None

The game’s name.

Deprecated since version 0.8.0: Use name instead.

is_steam_game()

Whether the game could be a Steam game.

Return type

bool

property url: str

What should be the game’s url on steamcommunity if applicable.

There are some predefined games which are:

Game Title

Accessed via

Team Fortress 2

steam.TF2

DOTA2

steam.DOTA2

Counter Strike Global-Offensive

steam.CSGO

Left for Dead 2

steam.LFD2

Steam

steam.STEAM

Games can be manually constructed using there app id eg:

my_rust_instance = steam.Game(id=252490, title="Rust")
# this can then be used for trading a game title 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) steam.Game

Create a custom game instance for change_presence(). The Game.id will be set to 15190414816125648896 and the Game.context_id to None.

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

Game

Attributes
Methods
class steam.game.StatefulGame

Games that have state.

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

steam.Clan

await player_count()

The games current player count.

Return type

int

await friends_who_own()

Fetch the users in your friend list who own this game.

Return type

list[steam.User]

await fetch()

Short hand for:

game = await client.fetch_game(game)
Return type

steam.game.FetchedGame

is_steam_game()

Whether the game could be a Steam game.

Return type

bool

property title: str | None

The game’s name.

Deprecated since version 0.8.0: Use name instead.

property url: str

What should be the game’s url on steamcommunity if applicable.

class steam.UserGame

Represents a Steam game fetched by steam.User.games()

total_play_time

The total time the game has been played for.

Type

datetime.timedelta

icon_url

The icon url of the game.

Type

str

logo_url

The logo url of the game.

Type

str

has_visible_stats()

Whether the game has publicly visible stats.

Return type

bool

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

steam.Clan

await fetch()

Short hand for:

game = await client.fetch_game(game)
Return type

steam.game.FetchedGame

await friends_who_own()

Fetch the users in your friend list who own this game.

Return type

list[steam.User]

is_steam_game()

Whether the game could be a Steam game.

Return type

bool

await player_count()

The games current player count.

Return type

int

property title: str | None

The game’s name.

Deprecated since version 0.8.0: Use name instead.

property url: str

What should be the game’s url on steamcommunity if applicable.

class steam.WishlistGame

Represents a Steam game fetched by steam.User.wishlist().

priority

The priority of the game in the wishlist.

Type

int

added_at

The time the the game was added to their wishlist.

Type

datetime.datetime

created_at

The time the game was uploaded at.

Type

datetime.datetime

background_url

The background URL of the game.

Type

str

rank

The global rank of the game by popularity.

Type

int

review_status

The review status of the game.

Type

Any

score

The score of the game out of ten.

Type

int

screenshots

The screenshots of the game.

Type

list[str]

tags

The tags of the game.

Type

list[str]

total_reviews

The total number reviews for the game.

Type

int

type

The type of the app.

Type

str

logo_url

The logo url of the game.

Type

str

is_free()

Whether or not the game is free to download.

Return type

bool

is_on_windows()

Whether or not the game is able to be played on Windows.

Return type

bool

is_on_mac_os()

Whether or not the game is able to be played on MacOS.

Return type

bool

is_on_linux()

Whether or not the game is able to be played on Linux.

Return type

bool

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

steam.Clan

await fetch()

Short hand for:

game = await client.fetch_game(game)
Return type

steam.game.FetchedGame

await friends_who_own()

Fetch the users in your friend list who own this game.

Return type

list[steam.User]

is_steam_game()

Whether the game could be a Steam game.

Return type

bool

await player_count()

The games current player count.

Return type

int

property title: str | None

The game’s name.

Deprecated since version 0.8.0: Use name instead.

property url: str

What should be the game’s url on steamcommunity if applicable.

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]

background_url

The background URL of the game.

Type

str

type

The type of the app.

Type

Union[Literal[‘game’], Literal[‘dlc’], Literal[‘demo’], Literal[‘advertising’], Literal[‘mod’], Literal[‘video’]]

logo_url

The logo URL of the game.

Type

str

dlc

The game’s downloadable content.

Type

Optional[list[steam.Game]]

website_url

The website URL of the game.

Type

Optional[str]

developers

The developers of the game.

Type

list[str]

publishers

The publishers of the game.

Type

list[str]

description

The short description of the game.

Type

str

full_description

The full description of the game.

Type

str

movies

A list of the game’s movies, each of which has name, id, url and optional created_at attributes.

Type

Optional[list[steam.game.Movie]]

property title: str | None

The game’s name.

Deprecated since version 0.8.0: Use name instead.

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

steam.Clan

await fetch()

Short hand for:

game = await client.fetch_game(game)
Return type

steam.FetchedGame

await friends_who_own()

Fetch the users in your friend list who own this game.

Return type

list[steam.User]

is_steam_game()

Whether the game could be a Steam game.

Return type

bool

await player_count()

The games current player count.

Return type

int

property url: str

What should be the game’s url on steamcommunity if applicable.

is_free()

Whether or not the game is free to download.

Return type

bool

is_on_windows()

Whether or not the game is able to be played on Windows.

Return type

bool

is_on_mac_os()

Whether or not the game is able to be played on MacOS.

Return type

bool

is_on_linux()

Whether or not the game is able to be played on Linux.

Return type

bool

Steam IDs

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: int

The instance of the SteamID.

property type: steam.enums.Type

The Steam type of the SteamID.

property universe: steam.enums.Universe

The Steam universe of the SteamID.

property id64: int

The SteamID’s 64 bit ID.

property id: int

The SteamID’s 32 bit ID.

property id2: str

The SteamID’s ID 2.

e.g STEAM_1:0:1234.

property id2_zero: str

The SteamID’s ID 2 accounted for bugged GoldSrc and Orange Box games.

Note

In these games the accounts universe, 1 for Type.Public, should be the X component of STEAM_X:0:1234 however, this was bugged and the value of X was 0.

e.g STEAM_0:0:1234.

property id3: str

The SteamID’s ID 3.

e.g [U:1:1234].

property invite_code: str | None

The SteamID’s invite code in the s.team invite code format.

e.g. cv-dgb.

property invite_url: str | None

The SteamID’s full invite code URL.

e.g https://s.team/p/cv-dgb.

property community_url: str | None

The SteamID’s community url.

e.g https://steamcommunity.com/profiles/123456789.

is_valid()

Whether or not the SteamID is valid.

Return type

bool

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

Optional[steam.abc.SteamID]

TradeOffers

class steam.TradeOffer(*, message=None, token=None, item_to_send=None, item_to_receive=None, items_to_send=None, items_to_receive=None)

Represents a trade offer from/to send to a User. This can also be used in steam.User.send().

Parameters
  • item_to_send (Items | None) – The item to send with the trade offer.

  • item_to_receive (Items | None) – The item to receive with the trade offer.

  • items_to_send (list) – The items you are sending to the other user.

  • items_to_receive (list) – The items you are receiving from the other user.

  • token (Optional[str]) – The 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 SteamID if the partner’s profile is private.

Type

Optional[Union[steam.User, steam.abc.SteamID]]

items_to_send

A list of items to send to the partner.

Type

list

items_to_receive

A list of items to receive from the partner.

Type

list

state

The offer state of the trade for the possible types see TradeOfferState.

Type

int

message

The message included with the trade offer.

Type

Optional[str]

id

The trade’s offer ID.

Type

int

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 None if 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
await accept()

Accepts the trade offer.

Note

This also calls confirm() (if necessary) so you don’t have to.

Raises
  • ClientException – The trade is either not active, already accepted or not from the ClientUser.

  • 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 counter(trade)

Counter a trade offer from an User.

Parameters

trade (steam.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

bool

is_our_offer()

Whether the offer was created by the ClientUser.

Return type

bool

Images

class steam.Image(fp, *, spoiler=False)

A wrapper around common image files. Used for steam.User.send().

Parameters
  • fp (io.BufferedIOBase) – An image or path-like to pass to open().

  • spoiler (bool) – Whether or not to mark the image as a spoiler.

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 Result that means we do not have permission to perform an action. Similar to Forbidden.

Subclass of WSException.

exception steam.WSNotFound(msg)

Exception that’s thrown when the websocket returns an Result that means the object wasn’t found. Similar to NotFound.

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.

Exception Hierarchy