def test_arg_steam2(self): self.assertIsNone(steamid.steam2_to_tuple('invalid_format')) self.assertEqual(steamid.steam2_to_tuple("STEAM_0:1:1"), (3, EType.Individual, EUniverse.Public, 1)) self.assertEqual(steamid.steam2_to_tuple("STEAM_1:1:1"), (3, EType.Individual, EUniverse.Public, 1)) self.assertEqual(steamid.steam2_to_tuple("STEAM_0:0:4"), (8, EType.Individual, EUniverse.Public, 1)) self.assertEqual(steamid.steam2_to_tuple("STEAM_1:0:4"), (8, EType.Individual, EUniverse.Public, 1))
def test_arg_steam2(self): self.assertIsNone(steamid.steam2_to_tuple('invalid_format')) self.assertEqual(steamid.steam2_to_tuple("STEAM_0:1:1"), (3, EType.Individual, EUniverse.Public, 1) ) self.assertEqual(steamid.steam2_to_tuple("STEAM_1:1:1"), (3, EType.Individual, EUniverse.Public, 1) ) self.assertEqual(steamid.steam2_to_tuple("STEAM_0:0:4"), (8, EType.Individual, EUniverse.Public, 1) ) self.assertEqual(steamid.steam2_to_tuple("STEAM_1:0:4"), (8, EType.Individual, EUniverse.Public, 1) )
def id_64(value): if is_a_URL(value): finale_id = steamid.steam64_from_url(value, http_timeout=30) else: if isinstance(value, str): if "STEAM" in value: accountID = steamid.steam2_to_tuple(value)[0] Steam_Id = steamid.SteamID(accountID) finale_id = Steam_Id.as_64 elif "[U" in value: accountID = steamid.steam3_to_tuple(value)[0] Steam_Id = steamid.SteamID(accountID) finale_id = Steam_Id.as_64 else: possible_URL = 'https://steamcommunity.com/id/{}/'.format( value) finale_id = steamid.steam64_from_url(possible_URL, http_timeout=30) elif isinstance(value, int): finale_id = value return finale_id