Coc.py

Latest version: v3.8.1

Safety actively analyzes 693883 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 4 of 9

3.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 :func:`coc.login` and :func:`coc.login_with_keys` were removed.
Use :func:`coc.Client.login` or :func:`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 :attr:`versus` things to :attr:`builder_base` things,
but there were some additions and a removal as well:

- :func:`coc.Client.get_location_clans_versus` -> :func:`coc.Client.get_location_clans_builder_base`
- :func:`coc.Client.get_location_players_versus` -> :func:`coc.Client.get_location_players_builder_base`
- :func:`coc.Clan.versus_points` -> :func:`coc.Clan.builder_base_points`
- :func:`coc.RankedClan.versus_points` -> :func:`coc.RankedClan.builder_base_points`
- :func:`coc.ClanMember.versus_trophies` -> :func:`coc.ClanMember.builder_base_trophies`
- :func:`coc.ClanMember.versus_rank` -> :func:`coc.ClanMember.builder_base_rank`
- :func:`coc.RankedPlayer.versus_trophies` -> :func:`coc.RankedPlayer.builder_base_trophies`
- :func:`coc.Player.versus_trophies` -> :func:`coc.Player.builder_base_trophies`
- :func:`coc.Player.best_versus_trophies` -> :func:`coc.Player.best_builder_base_trophies`
- :func:`coc.LegendStatistics.previous_versus_season` -> :func:`coc.LegendStatistics.previous_builder_base_season`
- :func:`coc.LegendStatistics.best_versus_season` -> :func:`coc.LegendStatistics.best_builder_base_season`
- :func:`coc.Player.versus_attack_wins` was removed
- :func:`coc.Clan.required_builder_base_trophies` was added
- :func:`coc.ClanMember.builder_base_league` was added
- :func:`coc.Client.search_builder_base_leagues` was added
- :func:`coc.Client.get_builder_base_league` was added
- :func:`coc.Client.get_builder_base_league_named` was added

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:

- :class:`coc.HOME_TROOP_ORDER` now knows the "Apprentice Warden"
- :class:`coc.SUPER_TROOP_ORDER` now knows the "Super Hog Rider"
- in the :class:`coc.BUILDER_TROOPS_ORDER`, "Super P.E.K.K.A" got renamed to "Power P.E.K.K.A"
- :class:`coc.BUILDER_TROOPS_ORDER` now knows the "Electrofire Wizard"
- :class:`coc.HERO_ORDER` now knows the "Battle Copter"

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:

- :class:`WarLeague` was replaced with :class:`BaseLeague` which has the same attributes, but is also used for the builder base league and the clan capital league
- :class:`League` inherits from :class:`BaseLeague` now and adds the :attr:`icon` attribute which is present for home village leagues
- :class:`League` lost its :attr:`localized_name` and :attr:`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:

- :func:`coc.Client.get_warlog` -> :func:`coc.Client.get_war_log`
- :func:`coc.Client.get_raidlog` -> :func:`coc.Client.get_raid_log`

:class:`coc.ClanMember` has a new cached property: :func:`player_house_elements`

:class:`coc.RaidDistrict` has a new :attr:`stars` attribute


**Full Changelog**: https://github.com/mathsman5133/coc.py/compare/v2.4.1...v3.0.0

3.0.0

2.4.1

Bugs Fixed:

- Fixed a bug with the retrieval of api keys

- Fixed `ClanEvents.member_count`


**Full Changelog**: https://github.com/mathsman5133/coc.py/compare/v2.4.0...v2.4.1

2.4.0

------
Additions:

- Added support for Player Houses in the clan capital: :func:`coc.Player.player_house_elements`

- Added optional cls parameters to all the :func:`coc.Client.get_location_...` methods
in order to allow the usage of custom classes

- Added the :ref:`triggers`

- Added some cached properties to raid classes: :func:`coc.RaidClan.looted`,
:func:`coc.RaidLogEntry.total_defensive_loot`, :func:`coc.RaidLogEntry.defense_attack_count`
and :func:`coc.RaidLogEntry.defensive_destroyed_district_count`

- Added `before`, `after` and `limit` parameters to :func:`coc.Client.get_members`, :func:`coc.Client.get_warlog` and
:func:`coc.Client.get_raidlog`

- Added :func:`coc.Client.search_war_leagues`, :func:`coc.Client.get_war_league`,
:func:`coc.Client.get_war_league_named`, :func:`coc.Client.search_capital_leagues`,
:func:`coc.Client.get_capital_league` and :func:`coc.Client.get_capital_league_named`


Changes:

- Changed the default value of the :attr:`coc.Client.throttle_limit` to a more reasonable value (30 instead of 10)


Bugs Fixed:

- Fixed a bug which affected :func:`coc.Client.login_with_keys`

- Fixed a bug which caused an overwrite of user set parameters if the client was used with a context manager

- Fixed a bug which resulted in the client using more keys than the key_count was

- Fixed a bug which caused a wrong throttle_limit if :func:`coc.Client.login_with_keys` or
:func:`coc.Client.login_with_tokens` was used

- Added previously missing Attribute :attr:`coc.RaidAttack.stars` which fixed a bug when checking
if two :class:`coc.RaidAttack` objects are equal

- Fixed a bug in :func:`coc.WarEvents.new_war`

- Fixed a bug in :func:`coc.Client.get_current_war` which caused Exceptions or wrong return values

What's Changed (auto generated by github)
* update g8_2.4.0 by doluk in https://github.com/mathsman5133/coc.py/pull/176
* Easier fix for login_with_tokens() by AumJavalgikar in https://github.com/mathsman5133/coc.py/pull/175
* Fixed bug in keys deletion by AumJavalgikar in https://github.com/mathsman5133/coc.py/pull/178
* add_cls_params by Kuchenmampfer in https://github.com/mathsman5133/coc.py/pull/180
* Fixed the name of a variable in README.rst by evgepab in https://github.com/mathsman5133/coc.py/pull/184
* Add trigger extension by lukasthaler in https://github.com/mathsman5133/coc.py/pull/182
* Idk why no one noticed this was broken lol by Kuchenmampfer in https://github.com/mathsman5133/coc.py/pull/189
* Fix versus trophies in event_example.py by Pythonic-Rainbow in https://github.com/mathsman5133/coc.py/pull/190
* fix missing stars attribute bug by Kuchenmampfer in https://github.com/mathsman5133/coc.py/pull/185
* extend_raid_log_entry by Kuchenmampfer in https://github.com/mathsman5133/coc.py/pull/179
* fix generator return typing + add clan_tag to war class by MagicTheDev in https://github.com/mathsman5133/coc.py/pull/188
* Improve __eq__ functions in raid classes by Kuchenmampfer in https://github.com/mathsman5133/coc.py/pull/186
* Rename first parameter of various classes hero/spell/troop by MagicTheDev in https://github.com/mathsman5133/coc.py/pull/187
* Fix for get_current_war by doluk in https://github.com/mathsman5133/coc.py/pull/192
* Bump to 2.4.0 by doluk in https://github.com/mathsman5133/coc.py/pull/193
* Fix pyproject.toml by doluk in https://github.com/mathsman5133/coc.py/pull/194

New Contributors
* evgepab made their first contribution in https://github.com/mathsman5133/coc.py/pull/184
* Pythonic-Rainbow made their first contribution in https://github.com/mathsman5133/coc.py/pull/190

**Full Changelog**: https://github.com/mathsman5133/coc.py/compare/v2.3.1...v2.4.0

2.3.1

* bump version numbers by Kuchenmampfer in https://github.com/mathsman5133/coc.py/pull/173


**Full Changelog**: https://github.com/mathsman5133/coc.py/compare/v2.3.0...v2.3.1

2.3.0

This release fixes multiple bugs.
Also multiple new features have been added like an event for new wars.
We worked on the docs, to improve their structure and readability.

Additions:
- Added new events `ClientEvents.raid_weekend_start`, `ClientEvents.raid_weekend_end`, `ClientEvents.clan_games_start`, `ClientEvents.clan_games_end`, `WarEvents.new_war` and `ClanEvents.member_versus_rank`
- Added utility functions `utils.get_clan_games_start`, `utils.get_clan_games_end`, `utils.get_raid_weekend_start` and `utils.get_raid_weekend_end`
- Added clan capital leaderboards
- Added `Clan.capital_points` and`Clan.family_friendly`
- Added `ClanMember.versus_rank`
- Added `Client.raw_attribute` to control if the new `_raw_data` attribute of various objects gets populated
- Added `full_war_api` as an extension
- Added `Client.login_with_tokens` offering the same functionality as `Client.login_with_keys` as an asynchronous function

Changes:
- Rename of LRU to FIFO in order to match the cache type (this is only internal)
- Restructured the documentation
- `Client.login_with_keys` was marked as deprecated

Bugs Fixed:
- Fixed a bug which affected the key creation if there are 10 keys with at least one having the correct name but wrong ip range
- Fixed a memory leak caused by python not properly freeing disk space after the removal of cache entries
- Fixed a bug that prevented :`Client.http.stats` from collecting API response time stats
- Fixed a bug that tried to use a cache when `max_cache_size` was set to 0
- Corrected order of elixir troops
- Fixed a bug when clans faced each other multiple times in one raid weekend
- Fixed a bug that caused automated tests on forks to fail
- Fixed a bug that prevented you from importing some classes as `coc.Class`

Contributions
We want to say thank you to all those who contributed!
* Fix memory leak by Kuchenmampfer in https://github.com/mathsman5133/coc.py/pull/154
* Fullwarapi public by doluk in https://github.com/mathsman5133/coc.py/pull/164
* add missing classes to __init__.py by Kuchenmampfer in https://github.com/mathsman5133/coc.py/pull/160
* Fix for only one raid per clan showing on atk/def log by MagicTheDev in https://github.com/mathsman5133/coc.py/pull/158
* add clan capital leaderboards by MagicTheDev in https://github.com/mathsman5133/coc.py/pull/157
* Moved "Electro Titan" at the end of elixir troops by rreemmii-dev in https://github.com/mathsman5133/coc.py/pull/155
* Adds new clan class fields by MagicTheDev in https://github.com/mathsman5133/coc.py/pull/159
* If less than 10 keys exist, at least 1 key can be made, but if 10 keys… by AumJavalgikar in https://github.com/mathsman5133/coc.py/pull/119
* huge docs restructuring by Kuchenmampfer in https://github.com/mathsman5133/coc.py/pull/166 and https://github.com/mathsman5133/coc.py/pull/167

**Full Changelog**: https://github.com/mathsman5133/coc.py/compare/v2.2.3...v2.3.0

Page 4 of 9

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.