Package: raidtoolkit
RaidToolkit ClientThis package provides access to the Raid Toolkit APIInstallationpip3installraidtoolkitUsageTo access APIs from RTK, use the RaidToolkitClient class to connect and read account information.importasynciofromraidtoolkitimportRaidToolkitClientasyncdefmain():client=RaidToolkitClient()client.connect()try:accounts=awaitclient.get_connected_accounts()foraccountinaccounts:print(f'Account:{account.name}')viewInfo=awaitaccount.get_current_view_info()print(f'\tCurrent View:{viewInfo["viewKey"]}({viewInfo["viewId"]})')lastBattleResponse=awaitaccount.get_last_battle_response()print(f'\tLast Battle Response:{lastBattleResponse["turnCount"]}turns')heroes=awaitaccount.get_heroes()nLegendary=len(list(filter(lambdahero:hero["type"]["rarity"]=='Legendary',heroes)))print(f'\tHero count:{len(heroes)}({nLegendary}legendary)')finally:# make sure to always close the client, or the python process will continue to run until the client is closed.client.close()if__name__=="__main__":asyncio.run(main())APIsRaidToolkitClientPropertiesStaticDataApiProvides access to the rawStaticDataApiAPI.AccountApiNOTE: All functions in theAccountApiare also available on theAccountobject returned fromget_*_accountsAPIs on theRaidToolkitClientclass.Provides access to the rawAccountApiAPI.RealtimeApiNOTE: All functions in theRealtimeApiare also available on theAccountobject returned fromget_*_accountsAPIs on theRaidToolkitClientclass.Provides access to the rawRealtimeApiAPI.Methodsget_all_accounts()Gets a list ofAccountwhich RTK has saved data for. Not all accounts may have a game client running.accounts=client.get_all_accounts()foraccountinaccounts:print(f'Account:{account.name}')get_connected_accounts()Gets a list ofAccountwhich RTK has saved data for, and have a game client running.accounts=client.get_connected_accounts()foraccountinaccounts:print(f'Account:{account.name}')StaticDataApiMethodsget_all_data()Gets all static data from RTK.data=client.StaticDataApi.get_all_data()print(data)get_localized_strings()Gets all localized strings from RTK.strings=client.StaticDataApi.get_localized_strings()print(strings["l10n:skill/description?id=57203#static"])# "Increases the damage inflicted by this Champion equal to the percentage of MAX HP destroyed on the target."get_arena_data()Gets all arena data from RTK.arena_data=client.StaticDataApi.get_arena_data()print(arena_data)get_artifact_data()Gets all artifact data from RTK.artifact_data=client.StaticDataApi.get_artifact_data()print(artifact_data)get_hero_data()Gets all hero data from RTK.hero_data=client.StaticDataApi.get_hero_data()print(hero_data)get_skill_data()Gets all skill data from RTK.skill_data=client.StaticDataApi.get_skill_data()print(skill_data)get_stage_data()Gets all stage data from RTK.stage_data=client.StaticDataApi.get_stage_data()print(stage_data)AccountObject which represents a single account in RTK. Account may or may not be connectedMethodsget_dump()Gets a dump of the account in RaidExtractor format.dump=account.get_dump()print(dump)get_artifacts()Gets a list of artifacts for the account.artifacts=account.get_artifacts()forartifactinartifacts:print(f'Artifact:{artifact}')# don't actually do this lolget_heroes(snapshot: bool)Gets a list of heroes for the account.strings=client.StaticDataApi.get_localized_strings()heroes=account.get_heroes()forheroinheroes:print(f'Hero #{hero["id"]}:{strings[hero["type"]["name"]["key"]]}')get_resources()Gets a list of resources for the account.resources=account.get_resources()print(resources)get_resources()Gets a list of resources for the account.resources=account.get_resources()print(resources)get_academy()Gets the faction guardian information for the account.academy=account.get_academy()print(academy)get_last_battle_response()Gets the last battle response for the account.last_battle_response=account.get_last_battle_response()print(last_battle_response)get_current_view_info()Gets the current view info for the account.current_view_info=account.get_current_view_info()print(f'\tCurrent View:{current_view_info["viewKey"]}({current_view_info["viewId"]})')