Repository navigation
Releases
v0.2.4
What's New in v0.2.4
This release represents a unified jump over v0.2.3 and brings four major features: request cancellation, persistent caching, telemetry observability, and request priority queuing, along with an overhauled MkDocs documentation system and critical bug fixes in the war, company, and worker namespaces.
1. Request Cancellation (AbortController)
Gracefully abort in-flight API requests using CancellationScope, the Python equivalent of JavaScript's AbortController.
CancellationScopeContext Manager: Seamlessly wrap API calls in anasync with CancellationScope() as scope:block. Callingscope.cancel()will instantly abort any pending tasks within that scope. Works with bothasync withand synchronouswith(viawarera.sync).- Pre-flight Batch Pruning: Cancelled requests are removed from the internal batch queue before they ever hit the network, saving bandwidth and rate-limit points.
2. Persistent Caching & Data Backends
The SWR (Stale-While-Revalidate) cache now supports pluggable storage backends via the CacheBackend protocol.
- SQLite Support: You can now initialize the client with
SQLiteCacheBackend("cache.db")to persist API responses across application restarts! This eliminates cold-start latency on bot restarts.
3. Network Telemetry & Request Priority
- Telemetry Hooks: Observe internal SDK behaviour by injecting a
TelemetryHooksimplementation at client initialization (e.g.,on_rate_limit_sleep,on_batch_flush,on_cache_hit). - Request Priority Queue: Tag individual requests with
RequestPriority.HIGHto bypass background traffic in the auto-batching queue. .envAuto-loading:WARERA_API_KEYis now automatically read fromos.environduring client initialization.
4. Documentation Overhaul
- MkDocs Migration: We've completely removed the legacy GitHub Wiki and migrated to a powerful, searchable MkDocs-based documentation site.
- Dynamic API Reference: The API reference is now dynamically generated straight from the library's Pydantic models, ensuring it never goes out of sync with the code.
- Automated Deployment: Set up a
.github/workflows/docs.ymlpipeline that automatically builds and deploys the documentation site to GitHub Pages whenever a newv*release tag is pushed.
5. Parameter Renames
batch_size→max_batch_size: Thebatch_sizeargument was renamed across the board to clarify that it represents a hard-cap limit (enforced at50by the server).- Affected:
WareraClient(max_batch_size=...) - Affected:
client.batch(max_batch_size=...) - Affected:
warera._batch.fetch_many_by_ids(max_batch_size=...)
- Affected:
6. New Resource Endpoints
Several new resource methods were wired up directly to the TRPC endpoints:
client.search.search_mus(query: str)client.search.search_users(query: str)client.tournament.get_by_id(tournament_id: str)client.user.get_users_by_country(country_id: str)client.region.get_all_list()client.government.get_by_country_id(country_id: str)client.company.get_recommended_region_ids_by_item_code(item_code: str)client.ranking.get_ranking(ranking_type: str, country_id: str | None)client.battle.get_ranking(battle_id: str)
7. New Enums & Options
- New
ItemCodeenum: A massiveStrEnummapping every single in-game item (e.g.ItemCode.HEAVY_AMMO,ItemCode.BOOTS6,ItemCode.CONCRETE, etc.) for strict typing. - New
SortBy&SortOrderenums: Added to standardize market and item sorting. ArticleTypeupdates: AddedMU,USER, andCOUNTRYfeed filters.RankingTypeupdates: AddedUSER_SKINS_OWNEDto track the new cosmetic leaderboards.
8. Bug Fixes
war.getByIdSchema & Parameter Fix: TheWarResourcewas completely broken: it was incorrectly passingidinstead ofwarIdto the API, and the Pydantic model (War) was missing all its nested fields (attacker,defender,is_active, etc.). It has been rewritten to perfectly match the live API's payload structure and successfully parses all objects.company.getCompaniesID dropping: The API returns a page of company ID strings, but the parser was strictly looking for dictionaries and dropping the string IDs. This causedget_companies,get_by_user, andcollect_by_usersto always appear empty. The client now properly captures the ID strings.get_companiesandcollect_allnow return a stream of those IDs, whileget_by_userandcollect_by_userstransparently fetch and hydrate the IDs into fullCompanyobjects under the hood.worker.getWorkersempty list: The API returns a{type, workers: [...]}payload, but the client only readitems/data, causingget_workers()to always return[]. It now correctly reads from theworkerskey and successfully maps theuser,company,wage, andjoinedAtdata into the strictWorkermodel.
Full Changelog: v0.2.3...v0.2.4
v0.2.3
What's Changed
- Enhance company resource methods by @bipinkrish in #17
- Add documentation and CI workflows for MkDocs site generation by @bipinkrish in #18
Full Changelog: v0.2.2...v0.2.3
v0.2.2
What's Changed
- Version 0.2.2 by @CrucifiedPain in #14
- Update pip install command in generate_wiki.yml by @CrucifiedPain in #15
- Aughhh by @CrucifiedPain in #16
Full Changelog: v0.2.1...v0.2.2
v0.2.1
What's Changed
- fix validation in GameConfig's debuffDurationHours by @bipinkrish in #12
- feat: implement missing Alliance endpoints and models by @CrucifiedPain in #13
Full Changelog: v0.2.0...v0.2.1
v0.2.0
What's Changed
- Refactor and complete v0.2.0 with schema validation and auth improvements by @bipinkrish in #11
Full Changelog: v0.1.9...v0.2.0
v0.1.9
v0.1.8
What's Changed
- adjusting for new api restrictions by @CrucifiedPain in #7
Full Changelog: v0.1.7...v0.1.8
v0.1.7
v0.1.6
v0.1.5
What's Changed
- Add WarEra v0.24.1 compliant changes. by @PAIN7177 in #6
Full Changelog: v0.1.4...v0.1.5