steamid

class steam.steamid.SteamID(*args, **kwargs)

Bases: int

Object for converting steamID to its’ various representations

SteamID()  # invalid steamid
SteamID(12345)  # accountid
SteamID('12345')
SteamID(id=12345, type='Invalid', universe='Invalid', instance=0)
SteamID(103582791429521412)  # steam64
SteamID('103582791429521412')
SteamID('STEAM_1:0:2')  # steam2
SteamID('[g:1:4]')  # steam3
class EType

Bases: steam.enums.base.SteamIntEnum

Doc: https://partner.steamgames.com/doc/api/steam_api#EAccountType

AnonGameServer = 4
AnonUser = 10
Chat = 8
Clan = 7
ConsoleUser = 9
ContentServer = 6
GameServer = 3
Individual = 1
Invalid = 0
Max = 11
Multiseat = 2
Pending = 5
class EUniverse

Bases: steam.enums.base.SteamIntEnum

Doc: https://partner.steamgames.com/doc/api/steam_api#EUniverse

Beta = 2
Dev = 4
Internal = 3
Invalid = 0
Max = 6
Public = 1
class EInstanceFlag

Bases: steam.enums.base.SteamIntEnum

An enumeration.

Clan = 524288
Lobby = 262144
MMSLobby = 131072
id
Returns:account id
Return type:int
account_id
Returns:account id
Return type:int
instance
Return type:int
type
Return type:steam.enum.EType
universe
Return type:steam.enum.EUniverse
as_32
Returns:account id
Return type:int
as_64
Returns:steam64 format
Return type:int
as_steam2
Returns:steam2 format (e.g STEAM_1:0:1234)
Return type:str

Note

STEAM_X:Y:Z. The value of X should represent the universe, or 1 for Public. However, there was a bug in GoldSrc and Orange Box games and X was 0. If you need that format use SteamID.as_steam2_zero

as_steam2_zero

For GoldSrc and Orange Box games. See SteamID.as_steam2

Returns:steam2 format (e.g STEAM_0:0:1234)
Return type:str
as_steam3
Returns:steam3 format (e.g [U:1:1234])
Return type:str
as_invite_code
Returns:s.team invite code format (e.g. cv-dgb)
Return type:str
as_csgo_friend_code
Returns:CS:GO Friend code (e.g. AEBJA-ABDC)
Return type:str
invite_url
Returns:e.g https://s.team/p/cv-dgb
Return type:str
community_url
Returns:e.g https://steamcommunity.com/profiles/123456789
Return type:str
is_valid()

Check whether this SteamID is valid

Return type:bool
static from_csgo_friend_code(code, universe=<EUniverse.Public: 1>)

Takes CS:GO friend code and returns SteamID

Parameters:
  • code (str) – CS:GO friend code (e.g. AEBJA-ABDC)
  • universe (EType) – Steam universe (default: Public)
Returns:

SteamID instance

Return type:

SteamID or None

static from_invite_code(code, universe=<EUniverse.Public: 1>)

Invites urls can be generated at https://steamcommunity.com/my/friends/add

Parameters:
  • code (str) – invite code (e.g. https://s.team/p/cv-dgb, cv-dgb)
  • universe (EType) – Steam universe (default: Public)
Returns:

(accountid, type, universe, instance)

Return type:

tuple or None

static from_url(url, http_timeout=30)

Takes Steam community url and returns a SteamID instance or None

See steam64_from_url() for details

Parameters:
  • url (str) – steam community url
  • http_timeout (int) – how long to wait on http request before turning None
Returns:

SteamID instance

Return type:

steam.SteamID or None

steam.steamid.steam2_to_tuple(value)
Parameters:value (str) – steam2 (e.g. STEAM_1:0:1234)
Returns:(accountid, type, universe, instance)
Return type:tuple or None

Note

The universe will be always set to 1. See SteamID.as_steam2

steam.steamid.steam3_to_tuple(value)
Parameters:value (str) – steam3 (e.g. [U:1:1234])
Returns:(accountid, type, universe, instance)
Return type:tuple or None
steam.steamid.steam64_from_url(url, http_timeout=30)

Takes a Steam Community url and returns steam64 or None

Warning

Each call makes a http request to steamcommunity.com

Note

For a reliable resolving of vanity urls use ISteamUser.ResolveVanityURL web api

Parameters:
  • url (str) – steam community url
  • http_timeout (int) – how long to wait on http request before turning None
Returns:

steam64, or None if steamcommunity.com is down

Return type:

int or None

Example URLs:

https://steamcommunity.com/gid/[g:1:4]
https://steamcommunity.com/gid/103582791429521412
https://steamcommunity.com/groups/Valve
https://steamcommunity.com/profiles/[U:1:12]
https://steamcommunity.com/profiles/76561197960265740
https://steamcommunity.com/id/johnc
https://steamcommunity.com/user/cv-dgb/
steam.steamid.from_url(url, http_timeout=30)

Takes Steam community url and returns a SteamID instance or None

See steam64_from_url() for details

Parameters:
  • url (str) – steam community url
  • http_timeout (int) – how long to wait on http request before turning None
Returns:

SteamID instance

Return type:

steam.SteamID or None