Client

The client class is the main entry point to start querying the Clash Royale API.

class clash_royale.Client[source]

Bases: Client

A client to retrieve data from the Clash Royale API.

Create a client instance with the given options.

>>> import clash_royale
>>> client = clash_royale.Client(api_key="your_api_key_here")

This client provides several methods to retrieve the content most kinds of Clash Royale objects, based on their json structure.

If your server does not have a static IP address, you can use a proxy server by setting the proxy parameter.

>>> client = clash_royale.Client(
        api_key="your_api_key_here",
        proxy="https://my.proxy.com",
    )

For more detail about proxy usage, check the usage section of the documentation.

Parameters:
  • api_key – The Clash Royale API key.

  • proxy – Proxy URL (default: None).

  • timeout – Request timeout in seconds (default: 10.0).

  • base_url – Base URL for the API (default: https://api.clashroyale.com/v1).

__init__(api_key: str, proxy: str | None = None, timeout: float = 10.0, base_url: str = 'https://api.clashroyale.com/v1')[source]
players: Players
clans: Clans
cards: Cards
tournaments: Tournaments
leaderboards: Leaderboards
locations: Locations
global_tournaments: GlobalTournaments