-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathsync.py
More file actions
39 lines (31 loc) · 1.13 KB
/
sync.py
File metadata and controls
39 lines (31 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import brawlstats
# Do not post your token on a public github!
client = brawlstats.Client('token')
player = client.get_profile('V2LQY9UY')
print(player.trophies) # access attributes using dot.notation
print(player.solo_victories) # use snake_case instead of camelCase
club = player.get_club()
if club is not None: # check if the player is in a club
print(club.tag)
members = club.get_members() # members sorted by trophies
# gets best 5 players or returns all members if the club has less than 5 members
index = max(5, len(members))
best_players = members[:index]
for player in best_players:
print(player.name, player.trophies) # prints name and trophies
# gets top 5 players in the world
ranking = client.get_rankings(ranking='players', limit=5)
for player in ranking:
print(player.name, player.rank)
# get top 5 mortis players in the US
ranking = client.get_rankings(
ranking='brawlers',
region='us',
limit=5,
brawler='mortis'
)
for player in ranking:
print(player.name, player.rank)
# Gets a player's recent battles
battles = client.get_battle_logs('UL0GCC8')
print(battles[0].battle.mode)