Module valolyticspy.services.api.valorant_api
Expand source code
import requests, sys
sys.path.append("")
from typing import List
from enum import Enum
from valolyticspy.exceptions import FailedAPIRequestException
from valolyticspy.dtos.valorant_api.agent import Agent
from valolyticspy.dtos.valorant_api.buddy import Buddy
from valolyticspy.dtos.valorant_api.bundle import Bundle
from valolyticspy.dtos.valorant_api.ceremony import Ceremony
from valolyticspy.dtos.valorant_api.competitive_tier import CompetitiveTier
from valolyticspy.dtos.valorant_api.content_tier import ContentTier
from valolyticspy.dtos.valorant_api.contract import Contract
from valolyticspy.dtos.valorant_api.currency import Currency
from valolyticspy.dtos.valorant_api.event import Event
from valolyticspy.dtos.valorant_api.game_mode import GameMode
from valolyticspy.dtos.valorant_api.gear import Gear
from valolyticspy.dtos.valorant_api.level_border import LevelBorder
from valolyticspy.dtos.valorant_api.map import Map
from valolyticspy.dtos.valorant_api.player_card import PlayerCard
from valolyticspy.dtos.valorant_api.player_title import PlayerTitle
from valolyticspy.dtos.valorant_api.season import Season
from valolyticspy.dtos.valorant_api.spray import Spray
from valolyticspy.dtos.valorant_api.theme import Theme
from valolyticspy.dtos.valorant_api.weapon import Weapon
from valolyticspy.dtos.valorant_api.version import Version
class Language(Enum):
"""
Enumeration representing the available languages in the Valorant API.
Each language is represented by a string value.
Available languages:
- ar_AE: Arabic (United Arab Emirates)
- de_DE: German (Germany)
- en_US: English (United States)
- es_ES: Spanish (Spain)
- es_MX: Spanish (Mexico)
- fr_FR: French (France)
- id_ID: Indonesian (Indonesia)
- it_IT: Italian (Italy)
- ja_JP: Japanese (Japan)
- ko_KR: Korean (South Korea)
- pl_PL: Polish (Poland)
- pt_BR: Portuguese (Brazil)
- ru_RU: Russian (Russia)
- th_TH: Thai (Thailand)
- tr_TR: Turkish (Turkey)
- vi_VN: Vietnamese (Vietnam)
- zh_CN: Chinese (China)
- zh_TW: Chinese (Taiwan)
"""
ar_AE = "ar-AE"
de_DE = "de-DE"
en_US = "en-US"
es_ES = "es-ES"
es_MX = "es-MX"
fr_FR = "fr-FR"
id_ID = "id-ID"
it_IT = "it-IT"
ja_JP = "ja-JP"
ko_KR = "ko-KR"
pl_PL = "pl-PL"
pt_BR = "pt-BR"
ru_RU = "ru-RU"
th_TH = "th-TH"
tr_TR = "tr-TR"
vi_VN = "vi-VN"
zh_CN = "zh-CN"
zh_TW = "zh-TW"
class ValorantApiClient:
"""
A client for interacting with the Valorant API.
This class provides methods for retrieving various data from the Valorant API, such as agents, buddies, bundles, ceremonies, competitive tiers, content tiers, contracts, currencies, events, game modes, gear, level borders, maps, player cards, player titles, seasons, sprays, themes, weapons, and version information.
Usage:
client = ValorantApiClient()
agents = client.get_agents()
buddies = client.get_buddies()
# ... (other method calls)
Args:
language (Language, optional): The language to use for the API responses. Defaults to Language.en_US.
Returns:
List: A list of objects representing the requested data.
Raises:
FailedAPIRequestException: If the API request fails.
"""
@classmethod
def get_agents(cls, language:Language=Language.en_US) -> List[Agent]:
"""
Retrieves a list of playable agents from the Valorant API.
Args:
language (Language, optional): The language to use for the agent names. Defaults to Language.en_US.
Returns:
List[Agent]: A list of Agent objects representing the playable agents.
"""
data:List[dict] = cls.handle_request(f"https://valorant-api.com/v1/agents?isPlayableCharacter=true&language={language.value}")['data']
return [Agent(**agent) for agent in data]
@classmethod
def get_buddies(cls, language:Language=Language.en_US) -> List[Buddy]:
"""
Retrieves a list of buddies from the Valorant API.
Args:
language (Language, optional): The language to use for the buddy names. Defaults to Language.en_US.
Returns:
List[Buddy]: A list of Buddy objects representing the buddies retrieved from the API.
"""
data:List[dict] = cls.handle_request(f"https://valorant-api.com/v1/buddies?language={language.value}")['data']
return [Buddy(**buddy) for buddy in data]
@classmethod
def get_bundles(cls, language:Language=Language.en_US) -> List[Bundle]:
"""
Retrieves a list of bundles from the Valorant API.
Args:
language (Language, optional): The language for the bundle data. Defaults to Language.en_US.
Returns:
List[Bundle]: A list of Bundle objects representing the bundles retrieved from the API.
"""
data:List[dict] = cls.handle_request(f"https://valorant-api.com/v1/bundles?language={language.value}")['data']
return [Bundle(**bundle) for bundle in data]
@classmethod
def get_ceremonies(cls, language: Language = Language.en_US) -> List[Ceremony]:
"""
Retrieves a list of ceremonies from the Valorant API.
Args:
language (Language, optional): The language for the ceremonies. Defaults to Language.en_US.
Returns:
List[Ceremony]: A list of Ceremony objects representing the retrieved ceremonies.
"""
data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/ceremonies?language={language.value}")['data']
data.append({"uuid": "00000000-0000-0000-0000-000000000000", "displayName": "WON", "assetPath": ""})
return [Ceremony(**ceremony) for ceremony in data]
@classmethod
def get_competitive_tiers(cls, language: Language = Language.en_US) -> List[CompetitiveTier]:
"""
Retrieves a list of competitive tiers from the Valorant API.
Args:
language (Language, optional): The language for the tier names. Defaults to Language.en_US.
Returns:
List[CompetitiveTier]: A list of CompetitiveTier objects representing the competitive tiers.
"""
data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/competitivetiers?language={language.value}")['data']
return [CompetitiveTier(**competitive_tier) for competitive_tier in data]
@classmethod
def get_content_tiers(cls, language: Language = Language.en_US) -> List[ContentTier]:
"""
Retrieves the content tiers from the Valorant API.
Args:
language (Language, optional): The language for the content tiers. Defaults to Language.en_US.
Returns:
List[ContentTier]: A list of ContentTier objects representing the content tiers.
"""
data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/contenttiers?language={language.value}")['data']
return [ContentTier(**content_tier) for content_tier in data]
@classmethod
def get_contracts(cls, language: Language = Language.en_US) -> List[Contract]:
"""
Retrieves a list of contracts from the Valorant API.
Args:
language (Language, optional): The language of the contracts. Defaults to Language.en_US.
Returns:
List[Contract]: A list of Contract objects representing the contracts.
"""
data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/contracts?language={language.value}")['data']
return [Contract(**contract) for contract in data]
@classmethod
def get_currencies(cls, language: Language = Language.en_US) -> List[Currency]:
"""
Retrieves a list of currencies from the Valorant API.
Args:
language (Language, optional): The language for the currency names. Defaults to Language.en_US.
Returns:
List[Currency]: A list of Currency objects representing the available currencies.
"""
data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/currencies?language={language.value}")['data']
return [Currency(**currency) for currency in data]
@classmethod
def get_events(cls, language: Language = Language.en_US) -> List[Event]:
"""
Retrieves a list of events from the Valorant API.
Args:
language (Language, optional): The language for the event descriptions. Defaults to Language.en_US.
Returns:
List[Event]: A list of Event objects representing the events.
"""
data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/events?language={language.value}")['data']
return [Event(**event) for event in data]
@classmethod
def get_game_modes(cls, language: Language = Language.en_US) -> List[GameMode]:
"""
Retrieves a list of game modes from the Valorant API.
Args:
language (Language, optional): The language to use for the game mode names. Defaults to Language.en_US.
Returns:
List[GameMode]: A list of GameMode objects representing the available game modes.
"""
data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/gamemodes?language={language.value}")['data']
return [GameMode(**game_mode) for game_mode in data]
@classmethod
def get_gear(cls, language: Language = Language.en_US) -> List[Gear]:
"""
Retrieves a list of gear items from the Valorant API.
Args:
language (Language, optional): The language for the gear item names. Defaults to Language.en_US.
Returns:
List[Gear]: A list of Gear objects representing the gear items.
"""
data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/gear?language={language.value}")['data']
return [Gear(**gear) for gear in data]
@classmethod
def get_level_borders(cls, language: Language = Language.en_US) -> List[LevelBorder]:
"""
Retrieves the level borders from the Valorant API.
Args:
language (Language, optional): The language for the level borders. Defaults to Language.en_US.
Returns:
List[LevelBorder]: A list of LevelBorder objects representing the level borders.
"""
data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/levelborders?language={language.value}")['data']
return [LevelBorder(**level_border) for level_border in data]
@classmethod
def get_maps(cls, language: Language = Language.en_US) -> List[Map]:
"""
Retrieves a list of maps from the Valorant API.
Args:
language (Language, optional): The language to retrieve the maps in. Defaults to Language.en_US.
Returns:
List[Map]: A list of Map objects representing the maps retrieved from the API.
"""
data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/maps?language={language.value}")['data']
return [Map(**map) for map in data]
@classmethod
def get_player_cards(cls, language: Language = Language.en_US) -> List[PlayerCard]:
"""
Retrieves a list of player cards from the Valorant API.
Args:
language (Language, optional): The language of the player cards. Defaults to Language.en_US.
Returns:
List[PlayerCard]: A list of PlayerCard objects representing the player cards.
"""
data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/playercards?language={language.value}")['data']
return [PlayerCard(**player_card) for player_card in data]
@classmethod
def get_player_titles(cls, language: Language = Language.en_US) -> List[PlayerTitle]:
"""
Retrieves a list of player titles from the Valorant API.
Args:
language (Language, optional): The language for the player titles. Defaults to Language.en_US.
Returns:
List[PlayerTitle]: A list of PlayerTitle objects representing the player titles.
"""
data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/playertitles?language={language.value}")['data']
return [PlayerTitle(**player_title) for player_title in data]
@classmethod
def get_seasons(cls, language: Language = Language.en_US) -> List[Season]:
"""
Retrieves a list of seasons from the Valorant API.
Args:
language (Language, optional): The language for the season data. Defaults to Language.en_US.
Returns:
List[Season]: A list of Season objects representing the seasons.
"""
data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/seasons?language={language.value}")['data']
return [Season(**season) for season in data]
@classmethod
def get_sprays(cls, language: Language = Language.en_US) -> List[Spray]:
"""
Retrieves a list of sprays from the Valorant API.
Args:
language (Language, optional): The language of the sprays to retrieve. Defaults to Language.en_US.
Returns:
List[Spray]: A list of Spray objects representing the retrieved sprays.
"""
data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/sprays?language={language.value}")['data']
return [Spray(**spray) for spray in data]
@classmethod
def get_themes(cls, language: Language = Language.en_US) -> List[Theme]:
"""
Retrieves a list of themes from the Valorant API.
Args:
language (Language, optional): The language for the themes. Defaults to Language.en_US.
Returns:
List[Theme]: A list of Theme objects representing the themes retrieved from the API.
"""
data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/themes?language={language.value}")['data']
return [Theme(**theme) for theme in data]
@classmethod
def get_weapons(cls, language: Language = Language.en_US) -> List[Weapon]:
"""
Retrieves a list of weapons from the Valorant API.
Args:
language (Language, optional): The language for the weapon data. Defaults to Language.en_US.
Returns:
List[Weapon]: A list of Weapon objects representing the weapons.
"""
data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/weapons?language={language.value}")['data']
return [Weapon(**weapon) for weapon in data]
@classmethod
def get_version(cls) -> str:
"""
Retrieves the version information from the game.
Returns:
dict: The version information.
"""
data: dict = cls.handle_request("https://valorant-api.com/v1/version")['data']
return Version(**data)
@staticmethod
def handle_request(url: str, headers: dict = {'user-agent': 'mozilla/5.0'}) -> dict:
"""
Sends a GET request to the specified URL with the given headers and returns the response as a JSON object.
Args:
url (str): The URL to send the GET request to.
headers (dict, optional): The headers to include in the request. Defaults to {'user-agent': 'mozilla/5.0'}.
Returns:
dict: The response from the API as a JSON object.
Raises:
FailedAPIRequestException: If the response status code is not 200.
"""
response = requests.get(url, headers=headers)
if response.status_code != 200:
raise FailedAPIRequestException()
return response.json()
Classes
class Language (value, names=None, *, module=None, qualname=None, type=None, start=1)-
Enumeration representing the available languages in the Valorant API.
Each language is represented by a string value.
Available languages: - ar_AE: Arabic (United Arab Emirates) - de_DE: German (Germany) - en_US: English (United States) - es_ES: Spanish (Spain) - es_MX: Spanish (Mexico) - fr_FR: French (France) - id_ID: Indonesian (Indonesia) - it_IT: Italian (Italy) - ja_JP: Japanese (Japan) - ko_KR: Korean (South Korea) - pl_PL: Polish (Poland) - pt_BR: Portuguese (Brazil) - ru_RU: Russian (Russia) - th_TH: Thai (Thailand) - tr_TR: Turkish (Turkey) - vi_VN: Vietnamese (Vietnam) - zh_CN: Chinese (China) - zh_TW: Chinese (Taiwan)
Expand source code
class Language(Enum): """ Enumeration representing the available languages in the Valorant API. Each language is represented by a string value. Available languages: - ar_AE: Arabic (United Arab Emirates) - de_DE: German (Germany) - en_US: English (United States) - es_ES: Spanish (Spain) - es_MX: Spanish (Mexico) - fr_FR: French (France) - id_ID: Indonesian (Indonesia) - it_IT: Italian (Italy) - ja_JP: Japanese (Japan) - ko_KR: Korean (South Korea) - pl_PL: Polish (Poland) - pt_BR: Portuguese (Brazil) - ru_RU: Russian (Russia) - th_TH: Thai (Thailand) - tr_TR: Turkish (Turkey) - vi_VN: Vietnamese (Vietnam) - zh_CN: Chinese (China) - zh_TW: Chinese (Taiwan) """ ar_AE = "ar-AE" de_DE = "de-DE" en_US = "en-US" es_ES = "es-ES" es_MX = "es-MX" fr_FR = "fr-FR" id_ID = "id-ID" it_IT = "it-IT" ja_JP = "ja-JP" ko_KR = "ko-KR" pl_PL = "pl-PL" pt_BR = "pt-BR" ru_RU = "ru-RU" th_TH = "th-TH" tr_TR = "tr-TR" vi_VN = "vi-VN" zh_CN = "zh-CN" zh_TW = "zh-TW"Ancestors
- enum.Enum
Class variables
var ar_AEvar de_DEvar en_USvar es_ESvar es_MXvar fr_FRvar id_IDvar it_ITvar ja_JPvar ko_KRvar pl_PLvar pt_BRvar ru_RUvar th_THvar tr_TRvar vi_VNvar zh_CNvar zh_TW
class ValorantApiClient-
A client for interacting with the Valorant API.
This class provides methods for retrieving various data from the Valorant API, such as agents, buddies, bundles, ceremonies, competitive tiers, content tiers, contracts, currencies, events, game modes, gear, level borders, maps, player cards, player titles, seasons, sprays, themes, weapons, and version information.
Usage
client = ValorantApiClient() agents = client.get_agents() buddies = client.get_buddies()
… (other method calls)
Args
language:Language, optional- The language to use for the API responses. Defaults to Language.en_US.
Returns
List- A list of objects representing the requested data.
Raises
FailedAPIRequestException- If the API request fails.
Expand source code
class ValorantApiClient: """ A client for interacting with the Valorant API. This class provides methods for retrieving various data from the Valorant API, such as agents, buddies, bundles, ceremonies, competitive tiers, content tiers, contracts, currencies, events, game modes, gear, level borders, maps, player cards, player titles, seasons, sprays, themes, weapons, and version information. Usage: client = ValorantApiClient() agents = client.get_agents() buddies = client.get_buddies() # ... (other method calls) Args: language (Language, optional): The language to use for the API responses. Defaults to Language.en_US. Returns: List: A list of objects representing the requested data. Raises: FailedAPIRequestException: If the API request fails. """ @classmethod def get_agents(cls, language:Language=Language.en_US) -> List[Agent]: """ Retrieves a list of playable agents from the Valorant API. Args: language (Language, optional): The language to use for the agent names. Defaults to Language.en_US. Returns: List[Agent]: A list of Agent objects representing the playable agents. """ data:List[dict] = cls.handle_request(f"https://valorant-api.com/v1/agents?isPlayableCharacter=true&language={language.value}")['data'] return [Agent(**agent) for agent in data] @classmethod def get_buddies(cls, language:Language=Language.en_US) -> List[Buddy]: """ Retrieves a list of buddies from the Valorant API. Args: language (Language, optional): The language to use for the buddy names. Defaults to Language.en_US. Returns: List[Buddy]: A list of Buddy objects representing the buddies retrieved from the API. """ data:List[dict] = cls.handle_request(f"https://valorant-api.com/v1/buddies?language={language.value}")['data'] return [Buddy(**buddy) for buddy in data] @classmethod def get_bundles(cls, language:Language=Language.en_US) -> List[Bundle]: """ Retrieves a list of bundles from the Valorant API. Args: language (Language, optional): The language for the bundle data. Defaults to Language.en_US. Returns: List[Bundle]: A list of Bundle objects representing the bundles retrieved from the API. """ data:List[dict] = cls.handle_request(f"https://valorant-api.com/v1/bundles?language={language.value}")['data'] return [Bundle(**bundle) for bundle in data] @classmethod def get_ceremonies(cls, language: Language = Language.en_US) -> List[Ceremony]: """ Retrieves a list of ceremonies from the Valorant API. Args: language (Language, optional): The language for the ceremonies. Defaults to Language.en_US. Returns: List[Ceremony]: A list of Ceremony objects representing the retrieved ceremonies. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/ceremonies?language={language.value}")['data'] data.append({"uuid": "00000000-0000-0000-0000-000000000000", "displayName": "WON", "assetPath": ""}) return [Ceremony(**ceremony) for ceremony in data] @classmethod def get_competitive_tiers(cls, language: Language = Language.en_US) -> List[CompetitiveTier]: """ Retrieves a list of competitive tiers from the Valorant API. Args: language (Language, optional): The language for the tier names. Defaults to Language.en_US. Returns: List[CompetitiveTier]: A list of CompetitiveTier objects representing the competitive tiers. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/competitivetiers?language={language.value}")['data'] return [CompetitiveTier(**competitive_tier) for competitive_tier in data] @classmethod def get_content_tiers(cls, language: Language = Language.en_US) -> List[ContentTier]: """ Retrieves the content tiers from the Valorant API. Args: language (Language, optional): The language for the content tiers. Defaults to Language.en_US. Returns: List[ContentTier]: A list of ContentTier objects representing the content tiers. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/contenttiers?language={language.value}")['data'] return [ContentTier(**content_tier) for content_tier in data] @classmethod def get_contracts(cls, language: Language = Language.en_US) -> List[Contract]: """ Retrieves a list of contracts from the Valorant API. Args: language (Language, optional): The language of the contracts. Defaults to Language.en_US. Returns: List[Contract]: A list of Contract objects representing the contracts. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/contracts?language={language.value}")['data'] return [Contract(**contract) for contract in data] @classmethod def get_currencies(cls, language: Language = Language.en_US) -> List[Currency]: """ Retrieves a list of currencies from the Valorant API. Args: language (Language, optional): The language for the currency names. Defaults to Language.en_US. Returns: List[Currency]: A list of Currency objects representing the available currencies. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/currencies?language={language.value}")['data'] return [Currency(**currency) for currency in data] @classmethod def get_events(cls, language: Language = Language.en_US) -> List[Event]: """ Retrieves a list of events from the Valorant API. Args: language (Language, optional): The language for the event descriptions. Defaults to Language.en_US. Returns: List[Event]: A list of Event objects representing the events. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/events?language={language.value}")['data'] return [Event(**event) for event in data] @classmethod def get_game_modes(cls, language: Language = Language.en_US) -> List[GameMode]: """ Retrieves a list of game modes from the Valorant API. Args: language (Language, optional): The language to use for the game mode names. Defaults to Language.en_US. Returns: List[GameMode]: A list of GameMode objects representing the available game modes. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/gamemodes?language={language.value}")['data'] return [GameMode(**game_mode) for game_mode in data] @classmethod def get_gear(cls, language: Language = Language.en_US) -> List[Gear]: """ Retrieves a list of gear items from the Valorant API. Args: language (Language, optional): The language for the gear item names. Defaults to Language.en_US. Returns: List[Gear]: A list of Gear objects representing the gear items. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/gear?language={language.value}")['data'] return [Gear(**gear) for gear in data] @classmethod def get_level_borders(cls, language: Language = Language.en_US) -> List[LevelBorder]: """ Retrieves the level borders from the Valorant API. Args: language (Language, optional): The language for the level borders. Defaults to Language.en_US. Returns: List[LevelBorder]: A list of LevelBorder objects representing the level borders. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/levelborders?language={language.value}")['data'] return [LevelBorder(**level_border) for level_border in data] @classmethod def get_maps(cls, language: Language = Language.en_US) -> List[Map]: """ Retrieves a list of maps from the Valorant API. Args: language (Language, optional): The language to retrieve the maps in. Defaults to Language.en_US. Returns: List[Map]: A list of Map objects representing the maps retrieved from the API. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/maps?language={language.value}")['data'] return [Map(**map) for map in data] @classmethod def get_player_cards(cls, language: Language = Language.en_US) -> List[PlayerCard]: """ Retrieves a list of player cards from the Valorant API. Args: language (Language, optional): The language of the player cards. Defaults to Language.en_US. Returns: List[PlayerCard]: A list of PlayerCard objects representing the player cards. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/playercards?language={language.value}")['data'] return [PlayerCard(**player_card) for player_card in data] @classmethod def get_player_titles(cls, language: Language = Language.en_US) -> List[PlayerTitle]: """ Retrieves a list of player titles from the Valorant API. Args: language (Language, optional): The language for the player titles. Defaults to Language.en_US. Returns: List[PlayerTitle]: A list of PlayerTitle objects representing the player titles. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/playertitles?language={language.value}")['data'] return [PlayerTitle(**player_title) for player_title in data] @classmethod def get_seasons(cls, language: Language = Language.en_US) -> List[Season]: """ Retrieves a list of seasons from the Valorant API. Args: language (Language, optional): The language for the season data. Defaults to Language.en_US. Returns: List[Season]: A list of Season objects representing the seasons. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/seasons?language={language.value}")['data'] return [Season(**season) for season in data] @classmethod def get_sprays(cls, language: Language = Language.en_US) -> List[Spray]: """ Retrieves a list of sprays from the Valorant API. Args: language (Language, optional): The language of the sprays to retrieve. Defaults to Language.en_US. Returns: List[Spray]: A list of Spray objects representing the retrieved sprays. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/sprays?language={language.value}")['data'] return [Spray(**spray) for spray in data] @classmethod def get_themes(cls, language: Language = Language.en_US) -> List[Theme]: """ Retrieves a list of themes from the Valorant API. Args: language (Language, optional): The language for the themes. Defaults to Language.en_US. Returns: List[Theme]: A list of Theme objects representing the themes retrieved from the API. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/themes?language={language.value}")['data'] return [Theme(**theme) for theme in data] @classmethod def get_weapons(cls, language: Language = Language.en_US) -> List[Weapon]: """ Retrieves a list of weapons from the Valorant API. Args: language (Language, optional): The language for the weapon data. Defaults to Language.en_US. Returns: List[Weapon]: A list of Weapon objects representing the weapons. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/weapons?language={language.value}")['data'] return [Weapon(**weapon) for weapon in data] @classmethod def get_version(cls) -> str: """ Retrieves the version information from the game. Returns: dict: The version information. """ data: dict = cls.handle_request("https://valorant-api.com/v1/version")['data'] return Version(**data) @staticmethod def handle_request(url: str, headers: dict = {'user-agent': 'mozilla/5.0'}) -> dict: """ Sends a GET request to the specified URL with the given headers and returns the response as a JSON object. Args: url (str): The URL to send the GET request to. headers (dict, optional): The headers to include in the request. Defaults to {'user-agent': 'mozilla/5.0'}. Returns: dict: The response from the API as a JSON object. Raises: FailedAPIRequestException: If the response status code is not 200. """ response = requests.get(url, headers=headers) if response.status_code != 200: raise FailedAPIRequestException() return response.json()Static methods
def get_agents(language: Language = Language.en_US) ‑> List[Agent]-
Retrieves a list of playable agents from the Valorant API.
Args
language:Language, optional- The language to use for the agent names. Defaults to Language.en_US.
Returns
List[Agent]- A list of Agent objects representing the playable agents.
Expand source code
@classmethod def get_agents(cls, language:Language=Language.en_US) -> List[Agent]: """ Retrieves a list of playable agents from the Valorant API. Args: language (Language, optional): The language to use for the agent names. Defaults to Language.en_US. Returns: List[Agent]: A list of Agent objects representing the playable agents. """ data:List[dict] = cls.handle_request(f"https://valorant-api.com/v1/agents?isPlayableCharacter=true&language={language.value}")['data'] return [Agent(**agent) for agent in data] def get_buddies(language: Language = Language.en_US) ‑> List[Buddy]-
Retrieves a list of buddies from the Valorant API.
Args
language:Language, optional- The language to use for the buddy names. Defaults to Language.en_US.
Returns
List[Buddy]- A list of Buddy objects representing the buddies retrieved from the API.
Expand source code
@classmethod def get_buddies(cls, language:Language=Language.en_US) -> List[Buddy]: """ Retrieves a list of buddies from the Valorant API. Args: language (Language, optional): The language to use for the buddy names. Defaults to Language.en_US. Returns: List[Buddy]: A list of Buddy objects representing the buddies retrieved from the API. """ data:List[dict] = cls.handle_request(f"https://valorant-api.com/v1/buddies?language={language.value}")['data'] return [Buddy(**buddy) for buddy in data] def get_bundles(language: Language = Language.en_US) ‑> List[Bundle]-
Retrieves a list of bundles from the Valorant API.
Args
language:Language, optional- The language for the bundle data. Defaults to Language.en_US.
Returns
List[Bundle]- A list of Bundle objects representing the bundles retrieved from the API.
Expand source code
@classmethod def get_bundles(cls, language:Language=Language.en_US) -> List[Bundle]: """ Retrieves a list of bundles from the Valorant API. Args: language (Language, optional): The language for the bundle data. Defaults to Language.en_US. Returns: List[Bundle]: A list of Bundle objects representing the bundles retrieved from the API. """ data:List[dict] = cls.handle_request(f"https://valorant-api.com/v1/bundles?language={language.value}")['data'] return [Bundle(**bundle) for bundle in data] def get_ceremonies(language: Language = Language.en_US) ‑> List[Ceremony]-
Retrieves a list of ceremonies from the Valorant API.
Args
language:Language, optional- The language for the ceremonies. Defaults to Language.en_US.
Returns
List[Ceremony]- A list of Ceremony objects representing the retrieved ceremonies.
Expand source code
@classmethod def get_ceremonies(cls, language: Language = Language.en_US) -> List[Ceremony]: """ Retrieves a list of ceremonies from the Valorant API. Args: language (Language, optional): The language for the ceremonies. Defaults to Language.en_US. Returns: List[Ceremony]: A list of Ceremony objects representing the retrieved ceremonies. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/ceremonies?language={language.value}")['data'] data.append({"uuid": "00000000-0000-0000-0000-000000000000", "displayName": "WON", "assetPath": ""}) return [Ceremony(**ceremony) for ceremony in data] def get_competitive_tiers(language: Language = Language.en_US) ‑> List[CompetitiveTier]-
Retrieves a list of competitive tiers from the Valorant API.
Args
language:Language, optional- The language for the tier names. Defaults to Language.en_US.
Returns
List[CompetitiveTier]- A list of CompetitiveTier objects representing the competitive tiers.
Expand source code
@classmethod def get_competitive_tiers(cls, language: Language = Language.en_US) -> List[CompetitiveTier]: """ Retrieves a list of competitive tiers from the Valorant API. Args: language (Language, optional): The language for the tier names. Defaults to Language.en_US. Returns: List[CompetitiveTier]: A list of CompetitiveTier objects representing the competitive tiers. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/competitivetiers?language={language.value}")['data'] return [CompetitiveTier(**competitive_tier) for competitive_tier in data] def get_content_tiers(language: Language = Language.en_US) ‑> List[ContentTier]-
Retrieves the content tiers from the Valorant API.
Args
language:Language, optional- The language for the content tiers. Defaults to Language.en_US.
Returns
List[ContentTier]- A list of ContentTier objects representing the content tiers.
Expand source code
@classmethod def get_content_tiers(cls, language: Language = Language.en_US) -> List[ContentTier]: """ Retrieves the content tiers from the Valorant API. Args: language (Language, optional): The language for the content tiers. Defaults to Language.en_US. Returns: List[ContentTier]: A list of ContentTier objects representing the content tiers. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/contenttiers?language={language.value}")['data'] return [ContentTier(**content_tier) for content_tier in data] def get_contracts(language: Language = Language.en_US) ‑> List[Contract]-
Retrieves a list of contracts from the Valorant API.
Args
language:Language, optional- The language of the contracts. Defaults to Language.en_US.
Returns
List[Contract]- A list of Contract objects representing the contracts.
Expand source code
@classmethod def get_contracts(cls, language: Language = Language.en_US) -> List[Contract]: """ Retrieves a list of contracts from the Valorant API. Args: language (Language, optional): The language of the contracts. Defaults to Language.en_US. Returns: List[Contract]: A list of Contract objects representing the contracts. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/contracts?language={language.value}")['data'] return [Contract(**contract) for contract in data] def get_currencies(language: Language = Language.en_US) ‑> List[Currency]-
Retrieves a list of currencies from the Valorant API.
Args
language:Language, optional- The language for the currency names. Defaults to Language.en_US.
Returns
List[Currency]- A list of Currency objects representing the available currencies.
Expand source code
@classmethod def get_currencies(cls, language: Language = Language.en_US) -> List[Currency]: """ Retrieves a list of currencies from the Valorant API. Args: language (Language, optional): The language for the currency names. Defaults to Language.en_US. Returns: List[Currency]: A list of Currency objects representing the available currencies. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/currencies?language={language.value}")['data'] return [Currency(**currency) for currency in data] def get_events(language: Language = Language.en_US) ‑> List[Event]-
Retrieves a list of events from the Valorant API.
Args
language:Language, optional- The language for the event descriptions. Defaults to Language.en_US.
Returns
List[Event]- A list of Event objects representing the events.
Expand source code
@classmethod def get_events(cls, language: Language = Language.en_US) -> List[Event]: """ Retrieves a list of events from the Valorant API. Args: language (Language, optional): The language for the event descriptions. Defaults to Language.en_US. Returns: List[Event]: A list of Event objects representing the events. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/events?language={language.value}")['data'] return [Event(**event) for event in data] def get_game_modes(language: Language = Language.en_US) ‑> List[GameMode]-
Retrieves a list of game modes from the Valorant API.
Args
language:Language, optional- The language to use for the game mode names. Defaults to Language.en_US.
Returns
List[GameMode]- A list of GameMode objects representing the available game modes.
Expand source code
@classmethod def get_game_modes(cls, language: Language = Language.en_US) -> List[GameMode]: """ Retrieves a list of game modes from the Valorant API. Args: language (Language, optional): The language to use for the game mode names. Defaults to Language.en_US. Returns: List[GameMode]: A list of GameMode objects representing the available game modes. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/gamemodes?language={language.value}")['data'] return [GameMode(**game_mode) for game_mode in data] def get_gear(language: Language = Language.en_US) ‑> List[Gear]-
Retrieves a list of gear items from the Valorant API.
Args
language:Language, optional- The language for the gear item names. Defaults to Language.en_US.
Returns
List[Gear]- A list of Gear objects representing the gear items.
Expand source code
@classmethod def get_gear(cls, language: Language = Language.en_US) -> List[Gear]: """ Retrieves a list of gear items from the Valorant API. Args: language (Language, optional): The language for the gear item names. Defaults to Language.en_US. Returns: List[Gear]: A list of Gear objects representing the gear items. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/gear?language={language.value}")['data'] return [Gear(**gear) for gear in data] def get_level_borders(language: Language = Language.en_US) ‑> List[LevelBorder]-
Retrieves the level borders from the Valorant API.
Args
language:Language, optional- The language for the level borders. Defaults to Language.en_US.
Returns
List[LevelBorder]- A list of LevelBorder objects representing the level borders.
Expand source code
@classmethod def get_level_borders(cls, language: Language = Language.en_US) -> List[LevelBorder]: """ Retrieves the level borders from the Valorant API. Args: language (Language, optional): The language for the level borders. Defaults to Language.en_US. Returns: List[LevelBorder]: A list of LevelBorder objects representing the level borders. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/levelborders?language={language.value}")['data'] return [LevelBorder(**level_border) for level_border in data] def get_maps(language: Language = Language.en_US) ‑> List[Map]-
Retrieves a list of maps from the Valorant API.
Args
language:Language, optional- The language to retrieve the maps in. Defaults to Language.en_US.
Returns
List[Map]- A list of Map objects representing the maps retrieved from the API.
Expand source code
@classmethod def get_maps(cls, language: Language = Language.en_US) -> List[Map]: """ Retrieves a list of maps from the Valorant API. Args: language (Language, optional): The language to retrieve the maps in. Defaults to Language.en_US. Returns: List[Map]: A list of Map objects representing the maps retrieved from the API. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/maps?language={language.value}")['data'] return [Map(**map) for map in data] def get_player_cards(language: Language = Language.en_US) ‑> List[PlayerCard]-
Retrieves a list of player cards from the Valorant API.
Args
language:Language, optional- The language of the player cards. Defaults to Language.en_US.
Returns
List[PlayerCard]- A list of PlayerCard objects representing the player cards.
Expand source code
@classmethod def get_player_cards(cls, language: Language = Language.en_US) -> List[PlayerCard]: """ Retrieves a list of player cards from the Valorant API. Args: language (Language, optional): The language of the player cards. Defaults to Language.en_US. Returns: List[PlayerCard]: A list of PlayerCard objects representing the player cards. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/playercards?language={language.value}")['data'] return [PlayerCard(**player_card) for player_card in data] def get_player_titles(language: Language = Language.en_US) ‑> List[PlayerTitle]-
Retrieves a list of player titles from the Valorant API.
Args
language:Language, optional- The language for the player titles. Defaults to Language.en_US.
Returns
List[PlayerTitle]- A list of PlayerTitle objects representing the player titles.
Expand source code
@classmethod def get_player_titles(cls, language: Language = Language.en_US) -> List[PlayerTitle]: """ Retrieves a list of player titles from the Valorant API. Args: language (Language, optional): The language for the player titles. Defaults to Language.en_US. Returns: List[PlayerTitle]: A list of PlayerTitle objects representing the player titles. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/playertitles?language={language.value}")['data'] return [PlayerTitle(**player_title) for player_title in data] def get_seasons(language: Language = Language.en_US) ‑> List[Season]-
Retrieves a list of seasons from the Valorant API.
Args
language:Language, optional- The language for the season data. Defaults to Language.en_US.
Returns
List[Season]- A list of Season objects representing the seasons.
Expand source code
@classmethod def get_seasons(cls, language: Language = Language.en_US) -> List[Season]: """ Retrieves a list of seasons from the Valorant API. Args: language (Language, optional): The language for the season data. Defaults to Language.en_US. Returns: List[Season]: A list of Season objects representing the seasons. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/seasons?language={language.value}")['data'] return [Season(**season) for season in data] def get_sprays(language: Language = Language.en_US) ‑> List[Spray]-
Retrieves a list of sprays from the Valorant API.
Args
language:Language, optional- The language of the sprays to retrieve. Defaults to Language.en_US.
Returns
List[Spray]- A list of Spray objects representing the retrieved sprays.
Expand source code
@classmethod def get_sprays(cls, language: Language = Language.en_US) -> List[Spray]: """ Retrieves a list of sprays from the Valorant API. Args: language (Language, optional): The language of the sprays to retrieve. Defaults to Language.en_US. Returns: List[Spray]: A list of Spray objects representing the retrieved sprays. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/sprays?language={language.value}")['data'] return [Spray(**spray) for spray in data] def get_themes(language: Language = Language.en_US) ‑> List[Theme]-
Retrieves a list of themes from the Valorant API.
Args
language:Language, optional- The language for the themes. Defaults to Language.en_US.
Returns
List[Theme]- A list of Theme objects representing the themes retrieved from the API.
Expand source code
@classmethod def get_themes(cls, language: Language = Language.en_US) -> List[Theme]: """ Retrieves a list of themes from the Valorant API. Args: language (Language, optional): The language for the themes. Defaults to Language.en_US. Returns: List[Theme]: A list of Theme objects representing the themes retrieved from the API. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/themes?language={language.value}")['data'] return [Theme(**theme) for theme in data] def get_version() ‑> str-
Retrieves the version information from the game.
Returns
dict- The version information.
Expand source code
@classmethod def get_version(cls) -> str: """ Retrieves the version information from the game. Returns: dict: The version information. """ data: dict = cls.handle_request("https://valorant-api.com/v1/version")['data'] return Version(**data) def get_weapons(language: Language = Language.en_US) ‑> List[Weapon]-
Retrieves a list of weapons from the Valorant API.
Args
language:Language, optional- The language for the weapon data. Defaults to Language.en_US.
Returns
List[Weapon]- A list of Weapon objects representing the weapons.
Expand source code
@classmethod def get_weapons(cls, language: Language = Language.en_US) -> List[Weapon]: """ Retrieves a list of weapons from the Valorant API. Args: language (Language, optional): The language for the weapon data. Defaults to Language.en_US. Returns: List[Weapon]: A list of Weapon objects representing the weapons. """ data: List[dict] = cls.handle_request(f"https://valorant-api.com/v1/weapons?language={language.value}")['data'] return [Weapon(**weapon) for weapon in data] def handle_request(url: str, headers: dict = {'user-agent': 'mozilla/5.0'}) ‑> dict-
Sends a GET request to the specified URL with the given headers and returns the response as a JSON object.
Args
url:str- The URL to send the GET request to.
headers:dict, optional- The headers to include in the request. Defaults to {'user-agent': 'mozilla/5.0'}.
Returns
dict- The response from the API as a JSON object.
Raises
FailedAPIRequestException- If the response status code is not 200.
Expand source code
@staticmethod def handle_request(url: str, headers: dict = {'user-agent': 'mozilla/5.0'}) -> dict: """ Sends a GET request to the specified URL with the given headers and returns the response as a JSON object. Args: url (str): The URL to send the GET request to. headers (dict, optional): The headers to include in the request. Defaults to {'user-agent': 'mozilla/5.0'}. Returns: dict: The response from the API as a JSON object. Raises: FailedAPIRequestException: If the response status code is not 200. """ response = requests.get(url, headers=headers) if response.status_code != 200: raise FailedAPIRequestException() return response.json()