Migrating to coc.py v3.0

Most of the outward facing library is the same, with a few changes detailed below. Significant changes are caused by builder base 2.0 update.

Logging in

The functions coc.login() and coc.login_with_keys() were removed. Use coc.Client.login() or coc.Client.login_with_tokens() instead.

Builder Base v2

The builder base revamp has caused a bunch of breaking changes. The most significant change is renaming all the versus things to builder_base things, but there were some additions and a removal as well:

Game Objects

coc.py game data was updated and now includes all the recently added troops and heros. This is also reflected in the following enumerations:

Leagues

Previously the structure of Leagues was a bit messy and not well aligned with what the API provides. Therefore they got a small rework:

  • WarLeague was replaced with BaseLeague which has the same attributes, but is also used for the builder base league and the clan capital league

  • League inherits from BaseLeague now and adds the icon attribute which is present for home village leagues

  • League lost its localized_name and localized_short_name attributes as they are not present in the API

Furthermore

In order to get more in line with our coding style, the following methods were renamed:

coc.ClanMember has a new cached property: player_house_elements()

coc.RaidDistrict has a new stars attribute