Player API Overview
The Player namespace provides access to individual player data from vlr.gg - info, teams, agent stats, match history, and consolidated profile.
The Player API provides detailed data for individual players on vlr.gg. It is accessed via vlrdevapi.player(id) (curried access) or through an explicit VLRClient instance.
All sub-namespaces are lazily initialized and share the same HTTP client configuration, timeout, retry, and rate-limiting settings.
Access Patterns
Module-level (default client)
import vlrdevapi
# Direct access (pass player_id each time)
info = vlrdevapi.player.info(player_id=438)
print(f"{info.name} ({info.real_name})")
# Curried access - pass player_id once, chain methods
player = vlrdevapi.player(438)
info = player.info()
print(f"Country: {info.country}")
agents = player.agents(timespan="60d")
print(f"Agents played: {len(agents.agents)}")Explicit client
from vlrdevapi import VLRClient
with VLRClient(timeout=30, requests_per_second=8) as client:
p = client.player(438)
info = p.info()
print(f"{info.name} ({info.real_name}) from {info.country}")Sub-namespace Reference
| Method | Returns | Description |
|---|---|---|
player.info(player_id) | PlayerInfo | Basic player info - name, real name, country, social links |
player.teams(player_id) | PlayerTeams | Current and past teams |
player.agents(player_id, timespan) | AgentStatsPage | Per-agent statistics over a time range |
player.matches(player_id, limit) | PlayerMatches | Match history for the player |
player.profile(player_id) | PlayerProfile | Consolidated profile - info + teams + top agents |
Common Error Handling
All player methods raise typed exceptions from vlrdevapi.exceptions:
| Exception | Raised When |
|---|---|
ValidationError | Invalid arguments (bad player_id, invalid timespan, etc.) |
NotFoundError | Player page doesn't exist (HTTP 404) |
RequestError | Network failure or HTTP error |
RateLimitError | Too many requests (HTTP 429) |
ParsingError | Page structure is unrecognised |
import vlrdevapi
from vlrdevapi.exceptions import NotFoundError, ValidationError
try:
info = vlrdevapi.player.info(player_id=438)
print(f"Player: {info.name}")
except NotFoundError:
print("Player not found")
except ValidationError as e:
print(f"Invalid input: {e}")Last updated on