players.profile()
Get a player's profile information
Signature
import vlrdevapi as vlr
result = vlr.players.profile(
player_id: int,
timeout: float = 5.0
) -> Profile | None
Parameters
Prop
Type
Return Value
Type: Profile | None
Returns player profile information or None
if not found.
Prop
Type
SocialLink fields:
Prop
Type
Team fields:
Prop
Type
Examples
Get Player Profile
import vlrdevapi as vlr
# Get player profile
player = vlr.players.profile(player_id=123)
if player:
print(f"Player: {player.handle}")
if player.real_name:
print(f"Real Name: {player.real_name}")
print(f"Country: {player.country or 'Unknown'}")
# Show current teams
if player.current_teams:
print("\nCurrent Teams:")
for team in player.current_teams:
print(f" {team.name} ({team.role})")
if team.joined_date:
print(f" Joined: {team.joined_date}")
# Show social links
if player.socials:
print("\nSocial Links:")
for social in player.socials:
print(f" {social.label}: {social.url}")
else:
print("Player not found")
Display Team History
import vlrdevapi as vlr
player = vlr.players.profile(player_id=123)
if player:
print(f"=== {player.handle} Team History ===")
# Current teams
print("\nCurrent:")
for team in player.current_teams:
print(f" {team.name} - {team.role}")
# Past teams
if player.past_teams:
print("\nPast:")
for team in player.past_teams:
dates = ""
if team.joined_date and team.left_date:
dates = f" ({team.joined_date} to {team.left_date})"
elif team.joined_date:
dates = f" (from {team.joined_date})"
print(f" {team.name} - {team.role}{dates}")
Get Team IDs
import vlrdevapi as vlr
player = vlr.players.profile(player_id=123)
if player:
# Get all team IDs
all_teams = player.current_teams + player.past_teams
team_ids = [team.id for team in all_teams if team.id is not None]
print(f"{player.handle} has played for {len(team_ids)} teams")
# Fetch detailed team info
for team_id in team_ids[:3]: # First 3 teams
team_info = vlr.teams.info(team_id)
if team_info:
print(f" {team_info.name} from {team_info.country}")
Check Player Status
import vlrdevapi as vlr
def get_player_status(player_id):
player = vlr.players.profile(player_id)
if not player:
return "Player not found"
if player.current_teams:
teams = ", ".join(t.name for t in player.current_teams if t.name)
return f"{player.handle} is currently on: {teams}"
else:
return f"{player.handle} is currently a free agent"
status = get_player_status(123)
print(status)
Error Handling
- Network failures: Returns
None
- Invalid player ID: Returns
None
- Player not found: Returns
None
The function never raises exceptions, making it safe to use without try-catch blocks.
Tips
- All list fields (
socials
,current_teams
,past_teams
) are always lists, neverNone
- Check for empty lists with
if player.current_teams:
before iterating - Team IDs may be
None
for some teams - The
role
field is always present and defaults to "Player" - Dates are parsed when available; check for
None
before using
Related
Source
Data scraped from: https://www.vlr.gg/player/{player_id}