Skip to content

Commit 57ec6f6

Browse files
dolukKuchenmampferMagic-JrGillesSchipperslukasthaler
authored
Update old branch (#272)
* Add triggers extension to pyproject.toml * rename logs * Fix bug causing old keys to be ignored. * Append keys properly to key list * Fix ClanEvents.member_count * bump version numbers and add changelog * re add event fix * correct changelog * fix typo * Add new mock data for clans * added default values for warTies, warLoses to deal with search clans vs clan endpoint * Write full tests for all attributes given directly by the api * Add clantag to mock data * Write a full test for raid seasons * Start migrating_to_v3.rst * Add changelog entry * Extend raidseason tests to cover all properties coc.py supports * fix missing attribute _cs_raid_attacks * bump version * Fix cache interaction with non 200 responses * Error with error code without response * remove expired key * fix missing attribute _cs_raid_attacks * bump version * Revamp mock data to a more non python approach, Update tests to still work * New Static Files & Rework * remove print * Update __init__.py * Update pyproject.toml * clean up object ids * clean up object ids * update examples * add builder base league * add player house elements at correct base class level * update requirements.txt for new static file origin * remove versus trophies test * remove object ids dependency * add blank line at file end * add doluk as maintainer * Fix BuilderBaseLeague * add BuilderBaseLeague * bump version * prevent circular import * Fix typo's! There were typo's in the examples with the "password" being "password * Another typo fixed! * Add stars property to RaidDistricts * add builder base league endpoints to client * rename the hopefully last internal xxxlogs to xxx_logs * remove incorrect documentation * add back triggers extension that somehow got lost in the weeds * write migration guide * improve migration guide and include it in the docs * Rewrite League and BaseLeague, fix Player.get_pet() * Add example for importing a client from one file everywhere * Add new example to docs * finish up the migration guide and put *something* into the acknowledgements * rename troop_meta to json_meta * chore: update static files * fix: ignore deprecated content * feature: add hero equipment * chore: add root rider and spirit fox * feature: add th level to ClanMember * fix: troop and hero change events misfiring (#218) * ensure DataContainer hash is static * fix: army link parser * fix hero hash * update clan example to include th level * release v3.1.0 * fix: readthedocs build config * chore: make equipment class importable * feature: add custom class support for war-related entities * release v3.2.0 * fix: month overflow in cg start/end * fix: spell lookup needs village flag * release v3.2.1 * Root Rider set as elixir troop (instead of dark elixir troop) * feature: split troops/spells by resource * chore: add new spells and equipment * chore: bump versions & add release notes * chore: update static data * fix: catch&raise stray response HTTP status codes * chore: version bump & release notes * Update workflow pushing to PyPi Move away from using username / password login and instead use OIDC. * Add workflow_dispatch to manually trigger push to PyPi * add back in checkout actions and use build instead of setuptools * make warning a bit more clear and add checkbox * don't run flow if confirmation fails * use false string in comparison * chore: docs updates * fix: add equipment to static data updater * chore: update static data * chore: add fireball equipment * chore: version bump & changelog * Delete docs/extensions/discord_links.rst * Delete examples/discord_links.py * Remove links api tests * Remove discord_links * chore: add missing achievements * feature: add a function to get the fingerprint * chore: manually update static data for balance patch * release v3.4.1 * fix: troop json * chore: add angry jelly pet * chore: update static data * bump versions & add changelog * add base url feature * move town hall level properly to clanmember * Add events for equipment * Fix renamed builder base attributes. Keep old ones due to breaking changes * Update events example with the builder base renaming * Update docs * Update version * bump version to 3.5.2 * bump version to 3.5.2 * add fallbacks to icon/badge URLs * version bump & changelog * fix: season endpoints typings, defaults & docstrings * update changelog * Fix docs * Add the logic to manually overwrite the ip used to create new keys * Update changelog.rst * Bump version number * Prevent unnecessary decoding * Fix typo in changelog entry * Bump version even further * added show inheritance property in all models * removed inheritance of base class if its just showing object * removed inheritance of base class of war,raid,etc if its just showing object * removed inheritance of data container inheriting class * made new line more consistent and removed one extra indendent * Bump version number * Update static data according to https://supercell.com/en/games/clashofclans/blog/game-updates/june-balance-changes/ * Add battle_modifier and enums for battle modifier, war state. Declutter Enums by bundeling core enum logic into ExtendedEnum. * Update changelog and add new equipment and troop * feature: add battle modifier to ClanWarLogEntry * feature: make war result an enum * chore: version bump & docs update * fix: ExtendedEnum.in_game_name can't use self in lookup * fix: make try_enum work with ExtendedEnum * chore: default battle modifier to BattleModifier.none * fix: battle modifier values are lowercase * Detect already decompressed files and don't try to decompress them again. Return stats about compression * Update static data * Update static data * Update static data * added magic mirror to equipments added magic mirror to equipments * chore: update static data * fix: ensure dict when querying with empty tag * chore: version bumps & docs * Enable gzip, deflate compression (#246) * Enable gzip, deflate compression * Bump version number * Update changelog.rst * updated static updater to use the "dynamic" way of getting fingerprint (so we dont have to mess w/ downloading apk ourself) * added new troop ids * added new spell ids * update enums w/ new troop, spell, hero, & equipment * new static files * Ignore cache for verify token endpoint * Don't pass ignore_cache to aiohttp request * Generalize cls definitions to be supported by every client api call. Introduce new kwargs lookup_cache, update_cache and ignore_cached_errors to handle cache utilization. * Point cls to newly introduced object_cls * Typedef fix * Fix Typing * new static files * new static files parsing * update json loaders to accomodate the new json based static files, which should heavily improve readability, reduce errors (because lists get finicky when items aren't there), and in a few cases simplify operations. Additionally changes to accomodate the new hero & to ignore non essential data like temp troops * change to order of unlocking * add lavaloon puppet * version change * cleanup * new version * added get_equipment * added get_equipment * fix hv & bb baby dragon swap * fix super troops * training cost no longer exists, and training time is constant * training cost no longer exists, and training time is constant * fix get_equipment, continued * Update enums.py * fix imports * remove import * remove walrus operator * remove space Co-authored-by: Lukas Dobler <69309597+doluk@users.noreply.github.com> * update changelog * update changelog * update changelog * update changelog * update changelog * Update conf.py * Kwargs Fix (#254) * fix: duplicated **kwarg values * chore: update versioning * docs: update changelog * fix: decorator must handle both async & sync functions * chore: cleanup decorator usage & remove manual cache setting assignments * refactor: use dictionary union instead of decorator to update kwargs * fix: set _defaults as property to allow it to use any updated values after init * fix: remove _defaults from slots * fix: move kwargs to correct spot * fix: remove comparison, always is true * chore: update version to 3.8.2 * docs: update changelog * Fix realtime kwargs (#258) * Don't pass realtime twice * Update version to 3.8.3 Bumped the library version to 3.8.3 in multiple file. Updated the changelog to document this fix. * fix get_members * fix: typo/misnamed super hog rider * docs: updated changelog * chore: bump version * Switch from ujson to orjson for improved performance Replaced ujson with orjson across the codebase to take advantage of its better performance and memory efficiency. Updated file handling to read in binary mode where necessary to support orjson's loading requirements. * Update requirements.txt * feat: update static files & add new siege & hero equipment from update * chore: bump version * docs: updated changelog * Update changelog.rst * v3.9.1 (#267) * Add Supercharger achievement * Update pyproject.toml * Update doc_requirements.txt * Update conf.py * Update changelog.rst * Fix formatting of `**kwargs` in changelog entry Corrected the markup surrounding `**kwargs` for consistency in the changelog. This ensures proper rendering in the documentation. * Update version to 3.9.1 Bump the version from 3.9.0 to 3.9.1 to reflect recent changes. This ensures the software version aligns with the latest updates and modifications. * Remove FullWar API extension from the codebase The FullWar API extension and its associated documentation have been fully removed. This functionality was limited to a small group of users and is no longer maintained or required. Any references to it have been deleted to clean up the codebase. * Remove `full_war_api` extension from documentation The `full_war_api` extension has been removed due to lack of maintenance. Associated references in the documentation have also been deleted to reflect this change. * Update minimum Python version to 3.9 across the project Raise the required Python version from 3.7 to 3.9 in configuration files, build workflows, and documentation. As 3.7 and 3.8 are eol. * Update changelog.rst * Update enums.py * Fix pyproject.toml to match what was done in #267 --------- Co-authored-by: Kuchenmampfer <79256346+Kuchenmampfer@users.noreply.github.com> Co-authored-by: tammes <tabu.der.erste@gmx.de> Co-authored-by: Magic-Jr <137152245+Magic-Jr@users.noreply.github.com> Co-authored-by: Gustavo Schip <50411615+GILLESMaster@users.noreply.github.com> Co-authored-by: lukasthaler <area.zweiundfuenfzig@gmail.com> Co-authored-by: Lukas Thaler <33826427+lukasthaler@users.noreply.github.com> Co-authored-by: MagicTheDev <82341152+MagicTheDev@users.noreply.github.com> Co-authored-by: RREEMMII <64311122+rreemmii-dev@users.noreply.github.com> Co-authored-by: Joshua Bramley <38833292+mathsman5133@users.noreply.github.com> Co-authored-by: mathsman5133 <mathsman5132@gmail.com> Co-authored-by: Anubhav1603 <anubhavsinha110@gmail.com> Co-authored-by: MagicTheDev <matthewanderson3607@gmail.com> Co-authored-by: Aum Javalgikar <aumjavalgikar@gmail.com> Co-authored-by: Joe <jmontanari1@gmail.com>
1 parent 14829d2 commit 57ec6f6

File tree

119 files changed

+133769
-1324
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+133769
-1324
lines changed

.github/workflows/push-to-pypi.yml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,35 @@
11
on:
2+
workflow_dispatch:
3+
inputs:
4+
confirmation:
5+
description: 'I want to manually trigger a PyPi push, without publishing a GitHub release (not recommended!)'
6+
required: true
7+
type: boolean
28
release:
39
types: [created]
410

511
jobs:
612
deploy:
13+
name: Upload release to PyPI
714
runs-on: ubuntu-latest
15+
environment:
16+
name: pypi
17+
url: https://pypi.org/p/coc.py
18+
permissions:
19+
id-token: write
20+
if: github.event_name != 'workflow_dispatch' || (github.event_name == 'workflow_dispatch' && github.event.inputs.confirmation != 'false')
821
steps:
9-
- uses: actions/checkout@v2
22+
- uses: actions/checkout@v4
1023
- name: Set up Python
11-
uses: actions/setup-python@v2
24+
uses: actions/setup-python@v5
1225
with:
1326
python-version: '3.x'
1427
- name: Install dependencies
1528
run: |
16-
python -m pip install --upgrade pip
17-
pip install setuptools wheel twine
18-
- name: Build and publish
19-
env:
20-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
21-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
29+
pip install --upgrade pip
30+
pip install --upgrade build
31+
- name: Build
2232
run: |
23-
python setup.py sdist bdist_wheel
24-
twine upload dist/*
33+
python -m build
34+
- name: Publish package distributions to PyPI
35+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/tests.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
# For example, pypy2 and pypy3
1212
matrix:
1313
# python-version: ["3.7.13", "3.8.13", "3.9.13", "3.10"]
14-
python-version: [3.8]
14+
python-version: [3.9]
1515

1616
steps:
1717
- uses: actions/checkout@v3
@@ -31,10 +31,7 @@ jobs:
3131
DEV_SITE_EMAIL: ${{ secrets.DEV_SITE_EMAIL }}
3232
DEV_SITE_PASSWORD: ${{ secrets.DEV_SITE_PASSWORD }}
3333
DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
34-
LINKS_API_USERNAME: ${{ secrets.LINKS_API_USERNAME }}
35-
LINKS_API_PASSWORD: ${{ secrets.LINKS_API_PASSWORD }}
3634
RUNNING_TESTS: true
3735
run: |
38-
python -m examples.discord_links
3936
python -m examples.events_example
4037
python -m examples.war_logs

.readthedocs.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ version: 2
22
formats: []
33

44
build:
5-
image: latest
5+
os: ubuntu-22.04
6+
tools:
7+
python: "3.9"
68

79
sphinx:
810
configuration: docs/conf.py
911
fail_on_warning: false
1012
builder: html
1113

1214
python:
13-
version: 3.7
1415
install:
1516
- method: pip
1617
path: .

README.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Getting Started
2626

2727
Installing
2828
-----------
29-
**Python 3.7 or higher is required**
29+
**Python 3.9 or higher is required**
3030

3131
.. code:: sh
3232
@@ -55,18 +55,18 @@ This example will get a player with a certain tag, and search for 5 clans with a
5555
async with coc.Client() as coc_client:
5656
try:
5757
await coc_client.login("email", "password")
58-
except coc.invalidcredentials as error:
58+
except coc.InvalidCredentials as error:
5959
exit(error)
6060
61-
player = await client.get_player("tag")
61+
player = await coc_client.get_player("tag")
6262
print(f"{player.name} has {player.trophies} trophies!")
6363
64-
clans = await client.search_clans(name="best clan ever", limit=5)
64+
clans = await coc_client.search_clans(name="best clan ever", limit=5)
6565
for clan in clans:
6666
print(f"{clan.name} ({clan.tag}) has {clan.member_count} members")
6767
6868
try:
69-
war = await client.get_current_war("#clantag")
69+
war = await coc_client.get_current_war("#clantag")
7070
print(f"{war.clan_tag} is currently in {war.state} state.")
7171
except coc.privatewarlog:
7272
print("uh oh, they have a private war log!")

coc/__init__.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,27 @@
2222
SOFTWARE.
2323
"""
2424

25-
__version__ = "2.3.1"
25+
__version__ = "3.9.1"
2626

2727
from .abc import BasePlayer, BaseClan
2828
from .clans import RankedClan, Clan
2929
from .client import Client
3030
from .events import PlayerEvents, ClanEvents, WarEvents, EventsClient, ClientEvents
3131
from .enums import (
32+
PlayerHouseElementType,
3233
Resource,
3334
Role,
3435
WarRound,
3536
ACHIEVEMENT_ORDER,
3637
BUILDER_TROOPS_ORDER,
3738
HERO_ORDER,
3839
PETS_ORDER,
40+
ELIXIR_TROOP_ORDER,
41+
DARK_ELIXIR_TROOP_ORDER,
3942
HOME_TROOP_ORDER,
4043
SIEGE_MACHINE_ORDER,
44+
ELIXIR_SPELL_ORDER,
45+
DARK_ELIXIR_SPELL_ORDER,
4146
SPELL_ORDER,
4247
SUPER_TROOP_ORDER,
4348
UNRANKED_LEAGUE_DATA,
@@ -53,8 +58,7 @@
5358
GatewayError,
5459
PrivateWarLog,
5560
)
56-
from .login import login, login_with_keys
57-
from .hero import Hero, Pet
61+
from .hero import Equipment, Hero, Pet
5862
from .http import BasicThrottler, BatchThrottler, HTTPClient
5963
from .iterators import (
6064
ClanIterator,
@@ -73,10 +77,11 @@
7377
LegendStatistics,
7478
LoadGameData,
7579
Location,
80+
PlayerHouseElement,
7681
Timestamp,
7782
TimeDelta,
7883
Label,
79-
WarLeague,
84+
BaseLeague
8085
)
8186
from .players import Player, ClanMember, RankedPlayer
8287
from .player_clan import PlayerClan

0 commit comments

Comments
 (0)