Skip to main content

BattleBit API

An abstraction layer for the BattleBit Public API that delivers a convenient data model

>>> from battlebit_api.BattleBitApiClient import BattleBitApiClient
>>> 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 Guide

At the top level of each interaction with the BattleBit Public API is the BattleBitApiClient. After creating an instance of this class, all available API methods can be called from there.

See documentation for in depth information.

Documentation

As the BattleBit API grows, so will this documentation. In the future it will be found in the repository.

BattleBitApiClient

BattleBitApiClientException Objects

class BattleBitApiClientException(Exception)

Thrown for unexpected exceptions.

Note: If you encounter this, please send an error report to this packages' maintainer.

BattleBitApiRateLimitExceeded Objects

class BattleBitApiRateLimitExceeded(Exception)

Thrown if the rate limit for the BattleBit API is reached

BattleBitApiClient Objects

class BattleBitApiClient()

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") -> None

Arguments:

  • root_endpoint: Endpoint URL to the BattleBit API, should point to the correct one by default.

get_server_list
def get_server_list(with_update: bool = True) -> ServerList

Returns a ServerList object. This does only pull from the BattleBit API if the server list has never

been 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 object

ServerList

ServerList Objects

class ServerList()

update
def update(servers: list[Server]) -> None

Updates the ServerList with a new set of Servers. Updates the last_updated property to the current timestamp.

Arguments:

  • servers: List of Server objects.

Returns:

None

search_for_server_by_name
def search_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 names

Returns:

All Servers in which the string search_str appears as a substring in the Servers name.

filter_servers
def filter_servers(server_filter: ServerFilter) -> Self

Returns a new ServerList that only contains Servers that match the ServerFilter.

ServerFilter properties that are set to None are ignored.

Arguments:

  • server_filter: ServerFilter object

Returns:

ServerList that only contains Servers that match the ServerFilter

get_servers_sorted_by_current_players
def get_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.

Examples

See examples in the project repository.

Data Classes

For 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 completeness

As 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.

Metadata

Release files for battlebit-api 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for battlebit-api 0.0.2
File Size Uploaded Provenance
battlebit-api-0.0.2.tar.gz 9.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for battlebit-api 0.0.2
File Interpreter ABI Platform
battlebit_api-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 20.5 kB

Release files / battlebit-api-0.0.2.tar.gz

Download URL battlebit-api-0.0.2.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2f024c011ca10d1925dee64771c17136cbe1af45a3b95b74eaa412d81c856a17
BLAKE2b-256 checksum
How to use checksums
41e6ea22d69cde5abef23cd849d5a2955e63e9d73fe160c5a8a043f9f9de76f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / battlebit_api-0.0.2-py3-none-any.whl

Download URL battlebit_api-0.0.2-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
47fd98f853e03a920ca772f51780337dc456c05dff5e7199db31c1e2db272cec
BLAKE2b-256 checksum
How to use checksums
7496d48ebf0d2bc5417cc7dbc88f50b69edd85998ec97bbeb2e40d2d7054df30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Security for battlebit-api 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page