diff --git a/steam/user.py b/steam/user.py index 1e392bd..882e865 100644 --- a/steam/user.py +++ b/steam/user.py @@ -71,6 +71,11 @@ def id64(self): """ Returns the 64 bit steam ID (use with other API requests) """ return int(self._prof["steamid"]) + @property + def id32(self): + """ Returns the 32 bit steam ID """ + return int(self.id64) - 76561197960265728 + @property def persona(self): """ Returns the user's persona (what you usually see in-game) """ diff --git a/tests/testuser.py b/tests/testuser.py index d9ccc96..5f3dc0f 100644 --- a/tests/testuser.py +++ b/tests/testuser.py @@ -4,6 +4,7 @@ class ProfileTestCase(unittest.TestCase): VALID_ID64 = 76561198014028523 + VALID_ID32 = 53762795 INVALID_ID64 = 123 # This is weird but there should be no reason that it's invalid. # So Valve, if you see this, be gewd guys and make 33 bit (condensed) @@ -39,6 +40,7 @@ def test_pathed_id(self): def test_valid_id(self): profile = user.profile(self.VALID_ID64) self.assertEqual(profile.id64, self.VALID_ID64) + self.assertEqual(profile.id32, self.VALID_ID32) def test_weird_id(self): profile = user.profile(self.WEIRD_ID64)