Skip to content

Conversation

@mathsman5133
Copy link
Owner

Please see the changelog with v0.2.0 for more information.

- `coc.login(email, pass)` function will now create a client and automatically create HTTP session and all related (and to come) "stuffs".
- `Client.on_key_reset()` event has been removed. It is redundant since the client handles all key changes
- All methods now have optional (default to True) `update_cache` parameter. This was necessary for the events branch, however should not affect normal usage.
- They compare via private `_data` attribute.
- Thrown when a 502 or 504 error occurs. The html given by api has been parsed into a text string
- This is still a very much work in progress.
- Provides same functionality as regular client
- You can 'subscribe' to events such as change in war (new attack, state change etc.), clan update (member join/leave, settings change etc.) or player update (troop level up, achievement change)
- Undocumented at present; read the source code if you wish to beta test, however lots of changes to make it better/easier to use / actually work incoming.
Clans:
- Clan
- BasicClan
- SearchClan
- WarClan
- LeagueClan

Players
- Player
- BasicPlayer
- WarMember
- SearchPlayer
- LeaguePlayer
- LeagueRankedPlayer

Wars
- BaseWar
- WarLog
- CurrentWar
- WarAttack
- LeagueGroup
- LeagueWar
- LeagueWarLogEntry

`await Timestamp.save(fp)` is now a thing.
- All master event runners now implement an `asyncio.Event` for better/easier use to start/stop the loop
- Everything moved out of __init__ into setup() function
- Added documentation
- You can now register multiple events with method `add_events(*fctns, function_dict)`. This will hopefully aid use.
- Redesign how meth `start_updates` works to utilise new events. Add a corresponding `stop_updates` method too.
- Add clan and player objects to some events that were missing these.
…r()` blocking method to run the script forever.
methods `add_war_update` and `add_player_update`s are no longer coroutines to aid setup
fix correct `event.set()` and `event.clear()` orders (got them backwards)
- `Client` now accepts `default_cache` parameter, a function to determine how cache will be set on client initiation. This defaults to `Client.default_cache()`, must **not** be a coroutine, and **must** take client as it's first and only parameter.

- `Client._cache_lookup` now provides a dict of all cache objects. The preferred way of accessing these is still `Client.get_cache`.
- `Client.set_cache` has been removed, replaced by `Client.default_cache` and `Client.edit_cache`.
- Copy Client docstring to EventsClient docstring automatically
string slice rather than index troop, spell, hero dicts
`on_player_troop_unlock` -> new troop unlocked
`on_player_spell_unlock` -> new spell unlocked
`on_player_hero_unlock` -> new hero unlocked

This also fixes a bug trying to index a list which didn't contain the new troop.
`cwl` --> the war is a league war
`friendly` --> the war is friendly (23hr prep)
`random` --> the war is random (other length prep)
- `CurrentWar` has been renamed to `ClanWar`
- `WarIterator` has been renamed to `ClanWarIterator`
- `Client.get_current_war` has been renamed to `Client.get_clan_war`
- `Client.get_current_wars` has been renamed to `Client.get_clan_wars`
- New Method: `Client.get_league_wars`: pass in multiple war tags to return a `LeagueWarIterator` of league wars found.
- New Method: `Client.get_current_war`: get a current war of a clan, be it ClanWar or LeagueWar. This abstracts the worries of dealing with war tags and simplifies what would otherwise be 2-3 calls.
- Likewise, `Client.get_current_wars` has been added: pass in multiple tags to get a `CurrentWarIterator` of current wars.
…` renamed to `time`, making it easier and shorter to use.
These are called after every 'round' of updater tasks is completed, ie after each sleep. They contain a List[List[event args]]. You can differentiate between different events within that group via the first arg which is the event name (with on_ prefix).

Add an extra cache to record events dispatched to aid with `on_X_batch_update` use.
Due to the way iterators use multithreading, this fails if a key needs to be reset. The function `Client.reset_keys()` has been added, and utilised in iterators. Babysteps, there please report more bugs.
…ly getting args for cache. Generally just make it work
- Previous implementation assumed that all events were going to be utilised, meaning default cache had no TTL even if events hadn't been started/added.
- Default cache for `EventsClient` is now the same as `Client`, with relevant cache instances only being cleared once an event has been startd.
…ceived`

When donations given + received respectively.
…n the docs.

Tidy up some linting/other minor fixes
@mathsman5133 mathsman5133 merged commit 7c36d04 into master Jun 17, 2019
@mathsman5133 mathsman5133 deleted the events branch June 17, 2019 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants