Skip to content

CDragonClient

from pulsefire.clients import CDragonClient

Bases: BaseClient

Community Dragon Client.

Resources Support
League of Legends
Legends of Runeterra ❎ Use DDragon instead.
Teamfight Tactics
Valorant

Example:

async with CDragonClient(
    default_params={"patch": "latest", "locale": "default"}
) as client:
    champion = await client.get_lol_v1_champion(id=777)
    assert champion["name"] == "Yone"

Source code in pulsefire/clients.py
class CDragonClient(BaseClient):
    """Community Dragon Client.

    | Resources            | Support                    |
    | -------------------- | -------------------------- |
    | League of Legends    | ✅                         |
    | Legends of Runeterra | ❎ Use DDragon instead.    |
    | Teamfight Tactics    | ✅                         |
    | Valorant             | ❎                         |

    Example:
    ```python
    async with CDragonClient(
        default_params={"patch": "latest", "locale": "default"}
    ) as client:
        champion = await client.get_lol_v1_champion(id=777)
        assert champion["name"] == "Yone"
    ```
    """

    Patch = Literal["latest", "pbe"] | _str
    Locale = Literal[
        "default", "ar_ae", "cs_cz", "de_de", "el_gr", "en_au", "en_gb", "en_ph", "en_sg", "en_us",
        "es_ar", "es_es", "es_mx", "fr_fr", "hu_hu", "it_it", "ja_jp", "ko_kr", "pl_pl", "pt_br",
        "ro_ro", "ru_ru", "th_th", "tr_tr", "vi_vn", "vn_vn", "zh_cn", "zh_my", "zh_tw",
    ] | _str

    def __init__(
        self,
        *,
        base_url: str = "https://raw.communitydragon.org",
        default_params: dict[str, Any] = {"patch": ..., "locale": ...},
        default_headers: dict[str, str] = {},
        default_queries: dict[str, str] = {},
        middlewares: list[Middleware] = [
            json_response_middleware(),
            http_error_middleware(),
        ],
    ) -> None:
        super().__init__(
            base_url=base_url,
            default_params=default_params,
            default_headers=default_headers,
            default_queries=default_queries,
            middlewares=middlewares
        )

    async def get_lol_champion_bin(self, *, patch: Patch = ..., key_lower: str = ...) -> dict[str, CDragonSchema.LolChampionBinValue]:
        return await self.invoke("GET", "/{patch}/game/data/characters/{key_lower}/{key_lower}.bin.json")

    async def get_lol_v1_champion(self, *, patch: Patch = ..., locale: Locale = ..., id: int = ...) -> CDragonSchema.LolV1Champion:
        return await self.invoke("GET", "/{patch}/plugins/rcp-be-lol-game-data/global/{locale}/v1/champions/{id}.json")

    async def get_lol_v1_champion_summary(self, *, patch: Patch = ..., locale: Locale = ...) -> list[CDragonSchema.LolV1ChampionInfo]:
        return await self.invoke("GET", "/{patch}/plugins/rcp-be-lol-game-data/global/{locale}/v1/champion-summary.json")

    async def get_lol_v1_items(self, *, patch: Patch = ..., locale: Locale = ...) -> list[CDragonSchema.LolV1Item]:
        return await self.invoke("GET", "/{patch}/plugins/rcp-be-lol-game-data/global/{locale}/v1/items.json")

    async def get_lol_v1_perks(self, *, patch: Patch = ..., locale: Locale = ...) -> list[CDragonSchema.LolV1Perk]:
        return await self.invoke("GET", "/{patch}/plugins/rcp-be-lol-game-data/global/{locale}/v1/perks.json")

    async def get_lol_v1_summoner_spells(self, *, patch: Patch = ..., locale: Locale = ...) -> list[CDragonSchema.LolV1SummonerSpell]:
        return await self.invoke("GET", "/{patch}/plugins/rcp-be-lol-game-data/global/{locale}/v1/summoner-spells.json")

    async def get_lol_v1_profile_icons(self, *, patch: Patch = ..., locale: Locale = ...) -> list[CDragonSchema.LolV1ProfileIcon]:
        return await self.invoke("GET", "/{patch}/plugins/rcp-be-lol-game-data/global/{locale}/v1/profile-icons.json")

    async def get_tft_data(self, *, patch: Patch = ..., locale: Locale = ...) -> CDragonSchema.TftData:
        return await self.invoke("GET", "/{patch}/cdragon/tft/{locale}.json")
Attributes
Patch class-attribute instance-attribute
Patch = Literal['latest', 'pbe'] | _str
Locale class-attribute instance-attribute
Locale = (
    Literal[
        "default",
        "ar_ae",
        "cs_cz",
        "de_de",
        "el_gr",
        "en_au",
        "en_gb",
        "en_ph",
        "en_sg",
        "en_us",
        "es_ar",
        "es_es",
        "es_mx",
        "fr_fr",
        "hu_hu",
        "it_it",
        "ja_jp",
        "ko_kr",
        "pl_pl",
        "pt_br",
        "ro_ro",
        "ru_ru",
        "th_th",
        "tr_tr",
        "vi_vn",
        "vn_vn",
        "zh_cn",
        "zh_my",
        "zh_tw",
    ]
    | _str
)
Functions
__init__
__init__(
    *,
    base_url: str = "https://raw.communitydragon.org",
    default_params: dict[str, Any] = {"patch": ..., "locale": ...},
    default_headers: dict[str, str] = {},
    default_queries: dict[str, str] = {},
    middlewares: list[Middleware] = [
        json_response_middleware(),
        http_error_middleware(),
    ]
) -> None
Source code in pulsefire/clients.py
def __init__(
    self,
    *,
    base_url: str = "https://raw.communitydragon.org",
    default_params: dict[str, Any] = {"patch": ..., "locale": ...},
    default_headers: dict[str, str] = {},
    default_queries: dict[str, str] = {},
    middlewares: list[Middleware] = [
        json_response_middleware(),
        http_error_middleware(),
    ],
) -> None:
    super().__init__(
        base_url=base_url,
        default_params=default_params,
        default_headers=default_headers,
        default_queries=default_queries,
        middlewares=middlewares
    )
get_lol_champion_bin async
get_lol_champion_bin(
    *, patch: Patch = ..., key_lower: str = ...
) -> dict[str, CDragonSchema.LolChampionBinValue]
Source code in pulsefire/clients.py
async def get_lol_champion_bin(self, *, patch: Patch = ..., key_lower: str = ...) -> dict[str, CDragonSchema.LolChampionBinValue]:
    return await self.invoke("GET", "/{patch}/game/data/characters/{key_lower}/{key_lower}.bin.json")
get_lol_v1_champion async
get_lol_v1_champion(
    *, patch: Patch = ..., locale: Locale = ..., id: int = ...
) -> CDragonSchema.LolV1Champion
Source code in pulsefire/clients.py
async def get_lol_v1_champion(self, *, patch: Patch = ..., locale: Locale = ..., id: int = ...) -> CDragonSchema.LolV1Champion:
    return await self.invoke("GET", "/{patch}/plugins/rcp-be-lol-game-data/global/{locale}/v1/champions/{id}.json")
get_lol_v1_champion_summary async
get_lol_v1_champion_summary(
    *, patch: Patch = ..., locale: Locale = ...
) -> list[CDragonSchema.LolV1ChampionInfo]
Source code in pulsefire/clients.py
async def get_lol_v1_champion_summary(self, *, patch: Patch = ..., locale: Locale = ...) -> list[CDragonSchema.LolV1ChampionInfo]:
    return await self.invoke("GET", "/{patch}/plugins/rcp-be-lol-game-data/global/{locale}/v1/champion-summary.json")
get_lol_v1_items async
get_lol_v1_items(
    *, patch: Patch = ..., locale: Locale = ...
) -> list[CDragonSchema.LolV1Item]
Source code in pulsefire/clients.py
async def get_lol_v1_items(self, *, patch: Patch = ..., locale: Locale = ...) -> list[CDragonSchema.LolV1Item]:
    return await self.invoke("GET", "/{patch}/plugins/rcp-be-lol-game-data/global/{locale}/v1/items.json")
get_lol_v1_perks async
get_lol_v1_perks(
    *, patch: Patch = ..., locale: Locale = ...
) -> list[CDragonSchema.LolV1Perk]
Source code in pulsefire/clients.py
async def get_lol_v1_perks(self, *, patch: Patch = ..., locale: Locale = ...) -> list[CDragonSchema.LolV1Perk]:
    return await self.invoke("GET", "/{patch}/plugins/rcp-be-lol-game-data/global/{locale}/v1/perks.json")
get_lol_v1_summoner_spells async
get_lol_v1_summoner_spells(
    *, patch: Patch = ..., locale: Locale = ...
) -> list[CDragonSchema.LolV1SummonerSpell]
Source code in pulsefire/clients.py
async def get_lol_v1_summoner_spells(self, *, patch: Patch = ..., locale: Locale = ...) -> list[CDragonSchema.LolV1SummonerSpell]:
    return await self.invoke("GET", "/{patch}/plugins/rcp-be-lol-game-data/global/{locale}/v1/summoner-spells.json")
get_lol_v1_profile_icons async
get_lol_v1_profile_icons(
    *, patch: Patch = ..., locale: Locale = ...
) -> list[CDragonSchema.LolV1ProfileIcon]
Source code in pulsefire/clients.py
async def get_lol_v1_profile_icons(self, *, patch: Patch = ..., locale: Locale = ...) -> list[CDragonSchema.LolV1ProfileIcon]:
    return await self.invoke("GET", "/{patch}/plugins/rcp-be-lol-game-data/global/{locale}/v1/profile-icons.json")
get_tft_data async
get_tft_data(
    *, patch: Patch = ..., locale: Locale = ...
) -> CDragonSchema.TftData
Source code in pulsefire/clients.py
async def get_tft_data(self, *, patch: Patch = ..., locale: Locale = ...) -> CDragonSchema.TftData:
    return await self.invoke("GET", "/{patch}/cdragon/tft/{locale}.json")