Browse Source

adjust SteamID format properties

pull/1/merge
Rossen Georgiev 10 years ago
parent
commit
2cc0102334
  1. 12
      README.rst
  2. 12
      steam/steamid.py

12
README.rst

@ -72,12 +72,16 @@ SteamID
>>> group = SteamID('[g:1:4]') >>> group = SteamID('[g:1:4]')
>>> group.id # accountid >>> group.id # accountid
4 4
>>> group.as_steam3 >>> group.as_32 # accountid
'[g:1:4]' 4
>>> group.as_32
'STEAM_0:0:2'
>>> group.as_64 >>> group.as_64
103582791429521412 103582791429521412
>>> str(group)
'103582791429521412'
>>> group.as_steam2
'STEAM_0:0:2'
>>> group.as_steam3
'[g:1:4]'
>>> group.community_url >>> group.community_url
'http://steamcommunity.com/gid/103582791429521412' 'http://steamcommunity.com/gid/103582791429521412'

12
steam/steamid.py

@ -154,6 +154,13 @@ class SteamID(object):
def __str__(self): def __str__(self):
return self.as_64 return self.as_64
@property
def as_steam2(self):
return "STEAM_0:%s:%s" % (
self.id % 2,
self.id >> 1,
)
@property @property
def as_steam3(self): def as_steam3(self):
return "[%s:%s:%s]" % ( return "[%s:%s:%s]" % (
@ -172,10 +179,7 @@ class SteamID(object):
@property @property
def as_32(self): def as_32(self):
return "STEAM_0:%s:%s" % ( return self.id
self.id % 2,
self.id >> 1,
)
@property @property
def community_url(self): def community_url(self):

Loading…
Cancel
Save