class MerakiCDNClient(BaseClient):
"""Meraki CDN Client.
| Resources | Support |
| -------------------- | -------------------------- |
| League of Legends | ✅ |
| Legends of Runeterra | ❎ |
| Teamfight Tactics | ❎ |
| Valorant | ❎ |
Does not support versioning by patch.
Example:
```python
async with MerakiCDNClient() as client:
champion = await client.get_lol_champion(key="Yone")
assert champion["id"] == 777
```
"""
def __init__(
self,
*,
base_url: str = "https://cdn.merakianalytics.com/riot",
default_params: dict[str, Any] = {},
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_champions(self) -> dict[str, MerakiCDNSchema.LolChampion]:
return await self.invoke("GET", "/lol/resources/latest/en-US/champions.json")
async def get_lol_champion(self, *, key: str = ...) -> MerakiCDNSchema.LolChampion:
return await self.invoke("GET", "/lol/resources/latest/en-US/champions/{key}.json")
async def get_lol_items(self) -> dict[str, MerakiCDNSchema.LolItem]:
return await self.invoke("GET", "/lol/resources/latest/en-US/items.json")
async def get_lol_item(self, *, id: int = ...) -> MerakiCDNSchema.LolItem:
return await self.invoke("GET", "/lol/resources/latest/en-US/items/{id}.json")
async def get_lol_champion_rates(self) -> MerakiCDNSchema.LolChampionRates:
return await self.invoke("GET", "/lol/resources/latest/en-US/championrates.json")