A fundamental wrapper for the Brawl Stars API covering all endpoints and including many features!


License
MIT
Install
pip install bstats==1.1.2

Documentation

Version Python-Versions License

BStats

  • This wrapper supports both sync and async requests to the Brawl Stars API
  • Required Python versions: 3.8 and higher

Features

  • Easy to use with an object oriented design.
  • Get a player's profile as well as their 25 most recent battles.
  • Get a club's statistics as well as its members and their individual statistics.
  • Get the top 200 rankings for players, clubs, or a specific brawler.
  • Get information about all currently available brawlers.
  • Get the current ongoing event rotation.

Installation

Install the latest, stable build:

pip install bstats

Install the development, unstable build:

pip install git+https://github.com/Bimi05/bstats
  • Be warned! Alpha/Beta releases may contain bugs! Please report them in the issues tab.

Usage Example

import asyncio
import bstats

client = bstats.Client("token")
# Never post any of your tokens for APIs on a public github!

# to use the async client, we'll need an async function
async def main():
    player = await client.get_player("80V2R98CQ")
    print(player.trophies, player.solo_victories)

    club = await client.get_club(player.club)
    if club:
       print(club.tag)
       members = club.members

       for player in members[:5]: # Get the top 5 club members
          print(player.name, player.trophies) # Show their name and their trophies

    # Get the top 5 players in the world
    best_players = await client.get_leaderboards(mode="players", limit=5)
    for player in best_players:
       print(player.name, player.rank) # Show their name and their rank on the leaderboard

    # Get the top 5 Meg players in the United Kingdom
    top_meg_players = await client.get_leaderboards(
       mode="brawlers",
       country="GB",
       limit=5,
       brawler="Meg"
    )
    for player in top_meg_players:
       print(player.name, player.rank)

    # Get a player's 25 most recent battles
    battles = await client.get_battlelogs("80V2R98CQ")
    print(battles[0].name) # Show the last mode the player battled in

    rotation = await client.get_event_rotation()
    for event in rotation:
       print(event.start, event.end, event.mode)

# we now create a loop to send us the data from the async client
loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Miscellaneous

  • Please star this repository if you're satisfied with the wrapper 😊
  • Have you come across an issue in the wrapper? No worries! Just create an issue!
  • If you need an API key, visit the Brawl Stars API page.
    • (You must create an account in order to create and use an API key)