Adapter

The Adapter Class is responsible for handling the HTTP requests to the Valorant API.

class valopy.adapter.Adapter(api_key, redact_header=True)[source]

Bases: object

Adapter for making HTTP requests to the Valorant API.

This adapter provides automatic model typing and elegant error handling for all Valorant API endpoints.

api_key

The API key used for authentication.

Type:

str

api_url

The base URL for the Valorant API.

Type:

str

async close()[source]

Close the persistent session.

Return type:

None

async get(endpoint_path, model_class, params=None)[source]

Make a GET request to the Valorant API.

Parameters:
  • endpoint_path (class:str) – The formatted API endpoint path to call.

  • model_class (Type[ValoPyModel]) – The dataclass type to deserialize the response into

  • params (Optional[class:dict]) – Query parameters to include in the request, by default None

Returns:

The result of the GET request.

Return type:

Result

async post(endpoint_path, model_class, params=None)[source]

Make a POST request to the Valorant API.

Parameters:
  • endpoint_path (class:str) – The formatted API endpoint path to call.

  • model_class (Type[ValoPyModel]) – The dataclass type to deserialize the response into

  • params (Optional[class:dict]) – Query parameters to include in the request, by default None

Returns:

The result of the POST request.

Return type:

Result