Package: battlebit-api
BattleBit APIAn abstraction layer for the BattleBit Public API that delivers a convenient data model>>>frombattlebit_api.BattleBitApiClientimportBattleBitApiClient>>>battle_bit_api_client=BattleBitApiClient()>>>battle_bit_api_client.get_server_list().servers[Server(name='172-Z-00',map=Map(name='Isle',size='Medium'),game_mode=<GameMode.DOMINATION:1>,region=<Region.JAPAN_CENTRAL:4>,current_players=64,max_players=64,players_in_queue=0,hz=60,is_day_mode=True,is_official=True,has_password=False,anti_cheat=<AntiCheatProvider.EAC:1>,server_version='Production 2.0.2'),...]Quick GuideAt the top level of each interaction with the BattleBit Public API is theBattleBitApiClient. After creating an instance of this class, all available API methods can be called from there.See documentation for in depth information.DocumentationAs the BattleBit API grows, so will this documentation. In the future it will be found in the repository.BattleBitApiClientBattleBitApiClientExceptionBattleBitApiRateLimitExceededBattleBitApiClient__init__get_server_listServerListServerListupdatesearch_for_server_by_namefilter_serversget_servers_sorted_by_current_playersBattleBitApiClientBattleBitApiClientException ObjectsclassBattleBitApiClientException(Exception)Thrown for unexpected exceptions.Note: If you encounter this, please send an error report to this packages' maintainer.BattleBitApiRateLimitExceeded ObjectsclassBattleBitApiRateLimitExceeded(Exception)Thrown if the rate limit for the BattleBit API is reachedBattleBitApiClient ObjectsclassBattleBitApiClient()Entrypoint class for the package. Obtain an instance of this class to make API calls.__init__def__init__(root_endpoint:str="https://publicapi.battlebit.cloud")->NoneArguments:root_endpoint: Endpoint URL to the BattleBit API, should point to the correct one by default.get_server_listdefget_server_list(with_update:bool=True)->ServerListReturns a ServerList object. This does only pull from the BattleBit API if the server list has neverbeen polled, or if forced to by the with_update switch.Arguments:with_update: If True, this method will get data from the API, if not it will return the cached ServerList.Returns:A ServerList objectServerListServerList ObjectsclassServerList()updatedefupdate(servers:list[Server])->NoneUpdates the ServerList with a new set of Servers. Updates the last_updated property to the current timestamp.Arguments:servers: List of Server objects.Returns:Nonesearch_for_server_by_namedefsearch_for_server_by_name(search_str:str)->list[Server]Returns all Servers in which the string search_str appears as a substring in the Servers name.This is case sensitive.Arguments:search_str: Substring to search for in Server namesReturns:All Servers in which the string search_str appears as a substring in the Servers name.filter_serversdeffilter_servers(server_filter:ServerFilter)->SelfReturns a new ServerList that only contains Servers that match the ServerFilter.ServerFilter properties that are set to None are ignored.Arguments:server_filter: ServerFilter objectReturns:ServerList that only contains Servers that match the ServerFilterget_servers_sorted_by_current_playersdefget_servers_sorted_by_current_players(many_to_few:bool=True)->list[Server]Returns a list of all Servers in the ServerList, sorted by the amount of current players on it.Arguments:many_to_few: Used to control if the list is ascending (False) or descending (True)Returns:List of all Servers in the ServerList, sorted by the amount of current players on it.ExamplesSeeexamples in the project repository.Data ClassesFor information about the classes that hold the server data and provide no other functionality, refer to the source code or use your IDE features.Regarding completenessAs of the time of this writing, the BattleBit Public API is still heavily under development. This package aims at being resilient towards changes, but can not guarantee that it will always be up to date with the API.