W
W
WeBBeW2022-02-22 20:34:32
Python
WeBBeW, 2022-02-22 20:34:32

How to get normal response from Brawl API using brawlstats library?

I need to get the results of the battles and for this I wrote the following lines:

import brawlstats
Client = brawlstats.Client("token")
print(str(Client.get_player("тэг")))
print(Client.get_battle_logs("тэг"))

This line print(str(Client.get_player("тэг")))prints the player's nickname
And this line print(Client.get_battle_logs("тэг"))prints :
<brawlstats.models.BattleLog object at 0x000002193E676050>


And it should be something like this:
spoiler
{
    "battleTime":"20190706T151526.000Z",
    "event":{
        "id":15000126,
        "mode":"duoShowdown",
        "map":"Royal Runway"
    },
    "battle":{
        "mode":"duoShowdown",
        "type":"ranked",
        "rank":1,
        "trophyChange":9,
        "teams":[
            [
                {
                    "tag":"#Y2QPGG",
                    "name":"Lex_YouTube",
                    "brawler":{
                        "id":16000005,
                        "name":"SPIKE",
                        "power":10,
                        "trophies":495
                    }
                },
                {
                    "tag":"#8Q229LJY",
                    "name":"Brandon",
                    "brawler":{
                        "id":16000003,
                        "name":"BROCK",
                        "power":10,
                        "trophies":495
                    }
                },
                    {
                    "tag":"#29RGL0QJ0",
                    "name":"smallwhitepeen1",
                    "brawler":{
                        "id":16000007,
                        "name":"JESSIE",
                        "power":7,
                        "trophies":486
                    }
                }
            ],
            [
                {
                    "tag":"#CYLVL8LY",
                    "name":"TST|ROYER™",
                    "brawler":{
                        "id":16000019,
                        "name":"PENNY",
                        "power":8,
                        "trophies":541
                    }
                },
                {
                    "tag":"#8P2URCR0",
                    "name":"ANOTHER",
                    "brawler":{
                        "id":16000023,
                        "name":"LEON",
                        "power":8,
                        "trophies":559
                    }
                },
                {
                    "tag":"#8LRY92QP",
                    "name":"Marshmello",
                    "brawler":{
                        "id":16000021,
                        "name":"GENE",
                        "power":7,
                        "trophies":448
                    }
                }
            ]
        ]
    }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question