Clans
Base Clan
- class coc.BaseClan
Abstract data class that represents base Clan objects
- tag
The clan’s tag
- Type:
str
- name
The clan’s name
- Type:
str
- level
The clan’s level.
- Type:
int
- get_detailed_members(cls: Type[Player] = None, load_game_data: bool = None) AsyncIterator[Player]
Get detailed player information for every player in the clan.
This returns a
PlayerIterator
which fetches all player tags in the clan in parallel.Example
clan = await client.get_clan(clan_tag) async for player in clan.get_detailed_members(): print(player.name)
- Yields:
Player
– A full player object of a clan member.
A formatted link to open the clan in-game
- Type:
str
Player Clan
- class coc.PlayerClan
Represents a clan that belongs to a player.
- tag
The clan’s tag
- Type:
str
- name
The clan’s name
- Type:
str
- level
The clan’s level.
- Type:
int
- get_detailed_members(cls: Type[Player] = None, load_game_data: bool = None) AsyncIterator[Player]
Get detailed player information for every player in the clan.
This returns a
PlayerIterator
which fetches all player tags in the clan in parallel.Example
clan = await client.get_clan(clan_tag) async for player in clan.get_detailed_members(): print(player.name)
- Yields:
Player
– A full player object of a clan member.
A formatted link to open the clan in-game
- Type:
str
Ranked Clan
- class coc.RankedClan
Represents the clan object returned by leader-board rankings.
- tag
The clan’s tag
- Type:
str
- name
The clan’s name
- Type:
str
- level
The clan’s level.
- Type:
int
- member_count
The number of members in the clan.
- Type:
int
- points
The clan’s trophy-count. If retrieving info for capital or builder base leader-boards, this will be
None
.- Type:
int
- builder_base_points
The clan’s builder base trophy count. If retrieving info for regular or capital leader boards, this will be
None
.- Type:
int
- capital_points
The clan’s capital trophy count. If retrieving info for regular or builder base leader boards, this will be
None
.- Type:
int
- rank
The clan’s rank in the leader board.
- Type:
int
- previous_rank
The clan’s rank in the previous season’s leaderboard.
- Type:
int
- get_detailed_members(cls: Type[Player] = None, load_game_data: bool = None) AsyncIterator[Player]
Get detailed player information for every player in the clan.
This returns a
PlayerIterator
which fetches all player tags in the clan in parallel.Example
clan = await client.get_clan(clan_tag) async for player in clan.get_detailed_members(): print(player.name)
- Yields:
Player
– A full player object of a clan member.
A formatted link to open the clan in-game
- Type:
str
War Clan
- class coc.WarClan
Represents a War Clan that the API returns.
Note
If this is called via
ClanWarLog.clan
, thenWarClan.members
,WarClan.attacks
andWarClan.defenses
will be empty.If this is called via
ClanWarLog.opponent
, thenWarClan.members
,WarClan.attacks
andWarClan.defenses
will be empty.WarClan.exp_earned
andWarClan.attacks
will beNone
.If this is called via
ClanWar.clan
orClanWar.opponent
thenWarClan.exp_earned
will beNone
.- tag
The clan’s tag
- Type:
str
- name
The clan’s name
- Type:
str
- level
The clan’s level.
- Type:
int
- stars
int
: Number of stars by clan this war.
- destruction
float
: Destruction as a percentage.
- exp_earned
int
: Total XP earned by clan this war.
- attacks_used
int
: Total attacks used by clan this war.
- max_stars
int
: Total possible stars achievable.
- total_attacks
int
: Total possible number of attacks usable by clan this war
- member_cls
The type which the members found in
Clan.members
will be of. Ensure any overriding of this inherits fromcoc.ClanMember
.- Type:
- attacks
Returns all clan member’s attacks this war. This is sorted by attack order.
- Type:
List[
WarAttack
]
- property average_attack_duration: int
Returns the average duration of all clan member’s attacks this war.
- Type:
int
- defenses
Returns all clan member’s defenses this war. This is sorted by attack order.
Equivalent to the other team’s
.attacks
property.- Type:
List[
WarAttack
]
- get_detailed_members(cls: Type[Player] = None, load_game_data: bool = None) AsyncIterator[Player]
Get detailed player information for every player in the clan.
This returns a
PlayerIterator
which fetches all player tags in the clan in parallel.Example
clan = await client.get_clan(clan_tag) async for player in clan.get_detailed_members(): print(player.name)
- Yields:
Player
– A full player object of a clan member.
- get_member(tag: str) Optional[ClanWarMember]
Get a member of the clan for the given tag, or
None
if not found.- Returns:
The clan member who matches the tag.: Optional[
ClanWarMember
]- Return type:
ClanWarMember or None
- property is_opponent: bool
Indicates whether the clan is the opponent.
- Type:
bool
- members
A list of members that are in the war. This is sorted by
ClanWarMember.map_position
- Type:
List[
ClanWarMember
]
A formatted link to open the clan in-game
- Type:
str
Clan War League Clan
- class coc.ClanWarLeagueClan
Represents a Clan War League Clan.
- tag
The clan’s tag
- Type:
str
- name
The clan’s name
- Type:
str
- level
The clan’s level.
- Type:
int
- get_detailed_members(cls: Type[Player] = None, load_game_data: bool = None) AsyncIterator[Player]
Get detailed player information for every player in the clan.
This returns a
PlayerIterator
which fetches all player tags in the clan in parallel.Example
clan = await client.get_clan(clan_tag) async for player in clan.get_detailed_members(): print(player.name)
- Yields:
Player
– A full player object of a clan member.
- members
A list of players participating in this clan war league season.
This list is selected when the clan chooses to participate in CWL, and will not change throughout the season. It is sometimes referred to as the master roster.
- Type:
List[
ClanWarLeagueClanMember
]
A formatted link to open the clan in-game
- Type:
str
Raid Clan
- class coc.RaidClan
Represents the clan object returned by clan raid seasons.
- tag
The clan’s tag
- Type:
str
- name
The clan’s name
- Type:
str
- level
The clan’s level.
- Type:
int
- attack_count
The number of attacks in the raid.
- Type:
int
- district_count
The number of districts in the raid.
- Type:
int
- destroyed_district_count
The number of destroyed districts in the raid.
- Type:
int
- index
int
- The index/order of the raid clan in the raid weekend
- raid_log_entry
RaidLogEntry
- The raid log entry this attack belongs to
- attacks
Returns all attacks in the raid against this clan.
- Type:
List[
RaidAttack
]
- districts
A
List
ofRaidDistrict
that the clan attacked.- Type:
List[
RaidDistrict
]
- looted
The amount of loot the raid clan got on all districts.
- Type:
int
Clan
- class coc.Clan
Represents a clan in Clash of Clans.
- tag
The clan’s tag
- Type:
str
- name
The clan’s name
- Type:
str
- level
The clan’s level.
- Type:
int
- type
The clan’s type for accepting members. This could be
open
,inviteOnly
orclosed
.- Type:
str
- family_friendly
Indicates the clan’s family friendly status. This can be True if family friendly, or False if not.
- Type:
bool
- description
The clan’s public description.
- Type:
str
- points
The clan’s trophy count. This is calculated according to members’ trophy counts.
- Type:
int
- builder_base_points
The clan’s builder base trophy count. This is calculated according to members’ builder base trophy counts.
- Type:
int
- capital_points
The clan’s clan capital points. Unsure how this is calculated.
- Type:
int
- required_trophies
The minimum trophies required to apply to this clan.
- Type:
int
- required_builder_base_trophies
The minimum builder base trophies required to apply to this clan.
- Type:
int
- required_townhall
The minimum townhall level required to apply to this clan.
- Type:
int
- war_frequency
The frequency for when this clan goes to war. For example, this could be
always
.- Type:
str
- war_win_streak
The clan’s current war winning streak.
- Type:
int
- war_wins
The number of wars the clan has won.
- Type:
int
- war_ties
The number of wars the clan has tied. This is only available from the clan search endpoint else -1.
- Type:
int
- war_losses
The number of wars the clan has lost. This is only available from the clan search endpoint else -1.
- Type:
int
- public_war_log
Indicates if the clan has a public war log. If this is
False
, operations to find the clan’s current war may raisePrivateWarLog
.- Type:
bool
- member_count
The number of members in the clan.
- Type:
int
- label_cls
The type which the labels found in
Clan.labels
will be of. Ensure any overriding of this inherits fromcoc.Label
.- Type:
- member_cls
The type which the members found in
Clan.members
will be of. Ensure any overriding of this inherits fromcoc.ClanMember
.- Type:
- capital_district_cls
The type which the clan capital districts found in
Clan.capital_districts
will be of. Ensure any overriding of this inherits fromcoc.CapitalDistrict
.- Type:
- war_league
The clan’s CWL league.
- Type:
- capital_league
The clan’s Clan Capital league.
- Type:
- capital_districts
A
List
ofCapitalDistrict
that the clan has.- Type:
List[
CapitalDistrict
]
- get_detailed_members(cls: Type[Player] = None, load_game_data: bool = None) AsyncIterator[Player]
Get detailed player information for every player in the clan.
This returns a
PlayerIterator
which fetches all player tags in the clan in parallel.Example
clan = await client.get_clan(clan_tag) async for player in clan.get_detailed_members(): print(player.name)
- Yields:
Player
– A full player object of a clan member.
- get_member(tag: str) Optional[ClanMember]
Return a
ClanMember
with the tag provided. ReturnsNone
if not found.Example
clan = await client.get_clan('clan_tag') member = clan.get_member('player_tag')
- Returns:
The member who matches the tag provided
- Return type:
Optional[
ClanMember
]
- get_member_by(**attrs) Optional[ClanMember]
Returns the first
ClanMember
that meets the attributes passedThis search implements the
coc.utils.get()
functionExample
clan = await client.get_clan("#clantag") member = clan.get_member_by(name="Joe") member = clan.get_member_by(level=125) member = clan.get_member_by(role=coc.Role.elder)
- members
A list of members that belong to the clan.
- Type:
List[
ClanMember
]
- members_dict
A dict of members that belong to the clan.
- Type:
Dict[str,
ClanMember
]
A formatted link to open the clan in-game
- Type:
str