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
def test_arg_steam3(self): self.assertIsNone(steamid.steam3_to_tuple('invalid_format')) self.assertEqual(steamid.steam3_to_tuple("[U:1:1234]"), (1234, EType.Individual, EUniverse.Public, 1)) self.assertEqual(steamid.steam3_to_tuple("[G:1:1234]"), (1234, EType.GameServer, EUniverse.Public, 1)) self.assertEqual(steamid.steam3_to_tuple("[g:1:4]"), (4, EType.Clan, EUniverse.Public, 0)) self.assertEqual(steamid.steam3_to_tuple("[A:1:4]"), (4, EType.AnonGameServer, EUniverse.Public, 0)) self.assertEqual(steamid.steam3_to_tuple("[A:1:1234:567]"), (1234, EType.AnonGameServer, EUniverse.Public, 567))
def test_arg_steam3(self): self.assertIsNone(steamid.steam3_to_tuple('invalid_format')) self.assertEqual(steamid.steam3_to_tuple("[U:1:1234]"), (1234, EType.Individual, EUniverse.Public, 1) ) self.assertEqual(steamid.steam3_to_tuple("[G:1:1234]"), (1234, EType.GameServer, EUniverse.Public, 1) ) self.assertEqual(steamid.steam3_to_tuple("[g:1:4]"), (4, EType.Clan, EUniverse.Public, 0) ) self.assertEqual(steamid.steam3_to_tuple("[A:1:4]"), (4, EType.AnonGameServer, EUniverse.Public, 0) ) self.assertEqual(steamid.steam3_to_tuple("[A:1:1234:567]"), (1234, EType.AnonGameServer, EUniverse.Public, 567) )
def test_arg_steam3(self): self.assertIsNone(steamid.steam3_to_tuple('invalid_format')) self.assertIsNone(steamid.steam3_to_tuple('')) self.assertIsNone(steamid.steam3_to_tuple(' ')) self.assertIsNone(steamid.steam3_to_tuple('[U:5:1234]')) self.assertIsNone(steamid.steam3_to_tuple('[i:5:1234]')) self.assertEqual(steamid.steam3_to_tuple("[i:1:1234]"), (1234, EType.Invalid, EUniverse.Public, 0) ) self.assertEqual(steamid.steam3_to_tuple("[I:1:1234]"), (1234, EType.Invalid, EUniverse.Public, 0) ) self.assertEqual(steamid.steam3_to_tuple("[U:0:1234]"), (1234, EType.Individual, EUniverse.Invalid, 1) ) self.assertEqual(steamid.steam3_to_tuple("[U:1:1234]"), (1234, EType.Individual, EUniverse.Public, 1) ) self.assertEqual(steamid.steam3_to_tuple("[G:1:1234]"), (1234, EType.GameServer, EUniverse.Public, 1) ) self.assertEqual(steamid.steam3_to_tuple("[g:1:4]"), (4, EType.Clan, EUniverse.Public, 0) ) self.assertEqual(steamid.steam3_to_tuple("[A:1:4]"), (4, EType.AnonGameServer, EUniverse.Public, 0) ) self.assertEqual(steamid.steam3_to_tuple("[A:1:1234:567]"), (1234, EType.AnonGameServer, EUniverse.Public, 567) ) self.assertEqual(steamid.steam3_to_tuple("[T:1:1234]"), (1234, EType.Chat, EUniverse.Public, 0) ) self.assertEqual(steamid.steam3_to_tuple("[L:1:1234]"), (1234, EType.Chat, EUniverse.Public, EInstanceFlag.Lobby) ) self.assertEqual(steamid.steam3_to_tuple("[c:1:1234]"), (1234, EType.Chat, EUniverse.Public, EInstanceFlag.Clan) )
def test_arg_steam3(self): self.assertIsNone(steamid.steam3_to_tuple('invalid_format')) self.assertIsNone(steamid.steam3_to_tuple('')) self.assertIsNone(steamid.steam3_to_tuple(' ')) self.assertIsNone(steamid.steam3_to_tuple('[U:5:1234]')) self.assertIsNone(steamid.steam3_to_tuple('[i:5:1234]')) self.assertEqual(steamid.steam3_to_tuple("[i:1:1234]"), (1234, EType.Invalid, EUniverse.Public, 0)) self.assertEqual(steamid.steam3_to_tuple("[I:1:1234]"), (1234, EType.Invalid, EUniverse.Public, 0)) self.assertEqual(steamid.steam3_to_tuple("[U:0:1234]"), (1234, EType.Individual, EUniverse.Invalid, 1)) self.assertEqual(steamid.steam3_to_tuple("[U:1:1234]"), (1234, EType.Individual, EUniverse.Public, 1)) self.assertEqual(steamid.steam3_to_tuple("[G:1:1234]"), (1234, EType.GameServer, EUniverse.Public, 1)) self.assertEqual(steamid.steam3_to_tuple("[g:1:4]"), (4, EType.Clan, EUniverse.Public, 0)) self.assertEqual(steamid.steam3_to_tuple("[A:1:4]"), (4, EType.AnonGameServer, EUniverse.Public, 0)) self.assertEqual(steamid.steam3_to_tuple("[A:1:1234:567]"), (1234, EType.AnonGameServer, EUniverse.Public, 567)) self.assertEqual(steamid.steam3_to_tuple("[T:1:1234]"), (1234, EType.Chat, EUniverse.Public, 0)) self.assertEqual( steamid.steam3_to_tuple("[L:1:1234]"), (1234, EType.Chat, EUniverse.Public, EInstanceFlag.Lobby)) self.assertEqual( steamid.steam3_to_tuple("[c:1:1234]"), (1234, EType.Chat, EUniverse.Public, EInstanceFlag.Clan))