Updates to spltools. Classes for Brawl data
I've begun work on an updated version of this post Celebrating 200 Splinterlands Brawls. A compilation of historical guild results and top brawlers. . That one was after we passed 200 Brawls. Now we have passed 250 and its time to do another one. Unfortunately, I was too busy the last weeks to time the post with the completion of brawl #250. Nevertheless, the update is coming soon.
I could have just used the same code I did last time, and had the post up already. But I wanted to take the chance to update spltools with code to work with guild data. Therefore, it will be a bit longer before that post is ready.
In this post I will go over the code I have added to spltools so far in this process. I'm also copying some of the code that I usually use to produce brawl reports.
Summary of updates
- Class to download and work with brawl data.
- Class to contain player brawl results.
- Example script for using these classes.
- New urls added to settings.py (Tournaments url, and some artwork urls).
New class: Brawl
I added a class for working with brawl data:
With the functions collapsed, the class summarizes to:
We have the init function, an internal function to fetch the brawl data, a string representation of the class, the function print_results, which prints results for each player in the guild we specify and a function to print a markdown table with the brawl results:
The output of this function produces tables like this:
| Guild | Wins | Losses | Crowns ![]() | SPS ![]() | Merits |
|---|---|---|---|---|---|
| Absalom | 90+38 | 40 | 148 | 117.950 | 8457 |
| Aggressive Gamblers | 83+38 | 47 | 140 | 111.499 | 7333 |
| PeakMonsters Legion | 90+24 | 22 | 131 | 105.049 | 7486 |
| PeakMonsters [Vikings] | 57+38 | 73 | 110 | 87.541 | 5762 |
| PeakMonsters [CHAMPS] | 44+38 | 86 | 95 | 75.562 | 4976 |
| Team Possible Diamond | 37+38 | 93 | 86 | 69.111 | 4914 |
| Roaring Twenties | 41+15 | 48 | 65 | 51.603 | 3714 |
| Druids | 20+7 | 37 | 31 | 24.880 | 1624 |
| HD HYBORIAN DREAM | 10+4 | 50 | 15 | 12.901 | 714 |
You might have seen these tables before if you clicked into one of my brawl reports.
New class: BrawlerResults
This class is a simple container that we use to store a player's results in a specific brawl. It collects the relevant data from the dictionary we get as part of the data returned by the call to find_brawl.
I also added a simple string representation, so that we can do:
print(brawler_result) # Where b is an instance of BrawlerResults
> kalkulus, fray 6: 8 W, 0 L, 0 AW.
Usage example
This file can be found at examples/brawl_data_example.py.
Output:
Final words
Thank you for your attention. If you are interested in more posts about the spltools python package, you can find the previous ones here:
spltools update posts:
spltools update: Reward chest classes
spltools update: Checking which set a card belongs to
Initial spltools commit
If you have not yet joined Splinterlands please click the referral link below to get started.
Best wishes
@Kalkulus
Leave Updates to spltools. Classes for Brawl data to:
Read more #splinterlands posts
Best Posts From kalkulus
We have not curated any of kalkulus's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From kalkulus
- PeakMonsters Pirates & Landlubbers: Brawl #289 Report
- PeakMonsters Legion & Premiere: Brawl #289 Report
- PeakMonsters Pirates & Landlubbers: Brawl #288 Report
- PeakMonsters Legion & Premiere: Brawl #288 Report
- PeakMonsters Pirates & Landlubbers: Brawl #287 Report
- PeakMonsters Legion & Premiere: Brawl #287 Report
- Conclave Arcana is soon upon us, and it's looking great!
- PeakMonsters Pirates & Landlubbers: Brawl #285 Report
- PeakMonsters Legion & Premiere: Brawl #285 Report
- PeakMonsters Pirates & Landlubbers: Brawl #284 Report


