Module: nintendo.switch.dragons

Provides a client for the dragons servers.

class DragonsError(Exception)
Raised when the dragons server returns an error code.

class DragonsClient
The dragons client.

DragonsError

response: HTTPResponse
type: str
name: str
title: str
detail: str
status: int
invalid_params: list | None

If present, the invalid_params field contains a list of dictionaries, each of which provides two keys: name and reason.

DragonsClient

def __init__(device_id: int = None)
Creates a new dragons client. The device id is required for all methods except for contents_authorization_token_for_aauth.

def set_request_callback(callback: Callable) -> None
By default, requests are performed with http.request. This method lets you provide a custom callback instead.

def set_context(context: TLSContext) -> None
Changes the TLS context. By default, the server certificate is verified with Nintendo Class 2 CA - G3 and no client certificate is used.

def set_certificate(cert: TLSCertificate, key: TLSPrivateKey) -> None Changes the client certificate of the current TLS context. The server rejects all requests without a valid client certificate.

def set_hosts(dragons: str, dragonst: str, tigers: str) -> None
Changes the servers to which the HTTP requests are sent. The defaults are:
* dragons.hac.lp1.dragons.nintendo.net
* dragonst.hac.lp1.dragons.nintendo.net
* tigers.hac.lp1.dragons.nintendo.net

def set_system_version(version: int) -> None
Changes the system version that is emulated by the client. The system version should be given as a decimal integer. For example, 1002 indicates system version 10.0.2. All system versions from 9.0.0 up to 22.1.0 are supported.

async def publish_device_linked_elicenses(device_token: str) -> dict
Requests all elicenses that are linked to the given device. The device token can be obtained from the dauth server.

async def exercise_elicense(device_token: str, elicense_ids: list[str], account_ids: list[int], current_account_id: int) -> None
Calls /v1/elicenses/exercise with the given parameters.

async def contents_authorization_token_for_aauth(device_token: str, elicense_id: str, na_id: int, title_id: int) -> dict
Requests a contents authorization token for aauth. The device token can be obtained from the dauth server.