Skip to content
This repository has been archived by the owner on Dec 22, 2024. It is now read-only.

v2.0.0

Latest
Compare
Choose a tag to compare
@sixP-NaraKa sixP-NaraKa released this 21 Jan 00:40
· 7 commits to main since this release

Adapted implementation to incorporate new aoe2.net API functionality:

  • removal of deprecated API endpoints (both general API and Nightbot API)
  • adding of new (request) parameters to existing functions (where applicable)

Additionally, the API request responses are now mapped to user-friendly Python objects, which are represented via Python's 3.7+ builtin dataclasses:

from aoe2netapi import API
from aoe2netapi.constants import LeaderboardId
from aoe2netapi.models import Leaderboard  # MatchHistory, RatingHistory, ...

api = API()
leaderboard: Leaderboard = api.get_leaderboard(leaderboard_id=LeaderboardId.AOE_TWO_RM, search="TheViper")
print(leaderboard)
# Leaderboard(total=42997, leaderboard_id=3, start=1, count=6,
#   players=[LeaderboardPlayer(...), ...], game='aoe2de', is_event_leaderboard=False)

for player in leaderboard.players:  # access to all properties via dot-notation
    print(player.rank, player.name, player.rating, player.highest_rating, ...)

Therefore with this change, the Python version requirement is 3.7+.

See the documentation for more information.