bundle.marvel_rivals.client =========================== .. py:module:: bundle.marvel_rivals.client .. autoapi-nested-parse:: Typed Marvel Rivals player statistics and a reusable HTTP client. Attributes ---------- .. autoapisummary:: bundle.marvel_rivals.client.API_BASE_URL Exceptions ---------- .. autoapisummary:: bundle.marvel_rivals.client.MarvelRivalsError Classes ------- .. autoapisummary:: bundle.marvel_rivals.client.MarvelData bundle.marvel_rivals.client.MatchStats bundle.marvel_rivals.client.HeroStats bundle.marvel_rivals.client.PlayerStats bundle.marvel_rivals.client.Champion bundle.marvel_rivals.client.ChampionStats bundle.marvel_rivals.client.Patch bundle.marvel_rivals.client.MarvelRivalsClient Module Contents --------------- .. py:data:: API_BASE_URL :value: 'https://marvelrivalsapi.com/api/v1' .. py:exception:: MarvelRivalsError Bases: :py:obj:`RuntimeError` A player lookup failed without exposing provider internals. .. py:class:: MarvelData(/, **data: Any) Bases: :py:obj:`bundle.core.data.Data` API model with stable, canonical Data serialization. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:class:: MatchStats(/, **data: Any) Bases: :py:obj:`MarvelData` Shared combat statistics for ranked matches and individual heroes. .. py:attribute:: matches :type: int .. py:attribute:: wins :type: int .. py:attribute:: kills :type: int .. py:attribute:: deaths :type: int .. py:attribute:: assists :type: int .. py:attribute:: mvps :type: int .. py:property:: win_rate :type: float | None .. py:property:: kda :type: float | None .. py:class:: HeroStats(/, **data: Any) Bases: :py:obj:`MatchStats` Hero performance shares the same combat model as ranked totals. .. py:attribute:: name :type: str .. py:attribute:: play_time :type: int :value: 0 .. py:class:: PlayerStats(/, **data: Any) Bases: :py:obj:`MarvelData` Player overview with aliases for the API's nested response shape. .. py:attribute:: uid :type: int .. py:attribute:: name :type: str .. py:attribute:: level :type: int | str | None .. py:attribute:: rank :type: str | None .. py:attribute:: ranked :type: MatchStats .. py:attribute:: heroes :type: list[HeroStats] .. py:attribute:: season :type: int | None :value: None .. py:property:: top_heroes :type: list[HeroStats] .. py:method:: from_api(payload: Any, *, season: int | None = None) -> PlayerStats :classmethod: Validate provider data without manual field-by-field copying. .. py:class:: Champion(/, **data: Any) Bases: :py:obj:`MarvelData` A playable hero from the public roster. .. py:attribute:: id :type: str | int .. py:attribute:: name :type: str .. py:attribute:: role :type: str :value: 'Unknown' .. py:property:: category :type: str .. py:class:: ChampionStats(/, **data: Any) Bases: :py:obj:`MatchStats` Global hero totals; the API does not provide a season filter. .. py:attribute:: name :type: str .. py:attribute:: id :type: str | int .. py:attribute:: total_hero_damage :type: int :value: 0 .. py:attribute:: total_hero_heal :type: int :value: 0 .. py:attribute:: total_damage_taken :type: int :value: 0 .. py:class:: Patch(/, **data: Any) Bases: :py:obj:`MarvelData` A dated game or balance update. .. py:attribute:: title :type: str .. py:attribute:: date :type: str .. py:attribute:: summary :type: str .. py:attribute:: kind :type: str .. py:class:: MarvelRivalsClient(api_key: str) One lazy HTTP connection pool shared by every bot command. .. py:attribute:: api_key .. py:attribute:: session :type: aiohttp.ClientSession | None :value: None .. py:method:: close() -> None :async: .. py:method:: player(uid: str, *, season: int | None = None) -> PlayerStats :async: Retrieve ranked statistics by numeric player UID. .. py:method:: champions() -> list[Champion] :async: All known playable heroes sorted by name. .. py:method:: champion_stats(query: str) -> ChampionStats :async: Global hero aggregates by name or numeric ID. .. py:method:: updates(limit: int = 5) -> list[Patch] :async: Recent game updates and balance releases, newest first. .. py:method:: balances(limit: int = 3) -> list[Patch] :async: Balance notes, not invented statistical win/pick rates.