Skip to main content

A Python Wrapper for valorant-api.com

Project description

Type-Safe Syncronous and Asyncronous Python wrapper for Valorant-API.com

This library supports both sync, and async for its endpoints, is type-checked and supports caching

Installation

pip install -U py-valorant

Quick start

This API does not require any type of authentication key.

Each endpoint object is documented.

First, initialize a ValorantAPI or ValorantAPIAsync object

#Sync
from py_valorant import ValorantAPI

api = ValorantAPI()
#Async
from py_valorant import ValorantAPIAsync

api = ValorantAPIAsync()
Parameters
  • language Optional[LANGUAGE] - Defualts to 'en-US'
    • The language of the supported returned strings (localized in the API).

Then you access any of the attributes inside that object. For this example, we'll use the agent attribute

Fetch every agent

#Sync
agents = api.agent.fetch_all()
#Async
agents = await api.agent.fetch_all()
Parameters
  • is_playable_character Optional[bool] - Defualts to False
  • cache Optional[bool] - Defualts to False
    • If True returns values saved in cache and if not found it fetches normally and saves to cache
    • If False removes the values previously cached by this method and its used parameters and fetches normally without caching
Returns
  • List[Agent]

Now let's print to the console all the Agents' display name

for agent in agents:
  print(str(agent)) # agent.display_name also works

Convert a URL to bytes

from py_valorant.utils import url_to_bytes

downloaded = url_to_bytes('https://exampleimage.com/image.png')
Parameters
  • url str
    • The URL of the resource to convert
  • run_thread Optional[bool] - Defualts to False
    • Whether to run the function in a new Thread
Returns
  • BytesIO

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py-valorant-1.0.2.tar.gz (19.3 kB view details)

Uploaded Source

Built Distribution

py_valorant-1.0.2-py3-none-any.whl (29.5 kB view details)

Uploaded Python 3

File details

Details for the file py-valorant-1.0.2.tar.gz.

File metadata

  • Download URL: py-valorant-1.0.2.tar.gz
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.0

File hashes

Hashes for py-valorant-1.0.2.tar.gz
Algorithm Hash digest
SHA256 8b4ef83818edb5a8a113f914a16accd2834d94406278c4f08be90e6fd38e02c0
MD5 1bdc2f426f73c9fed0d8ba6f0ce7d34b
BLAKE2b-256 078afb3f907ee3596468fb5a14eed1b51b236ef24399cc72a4fb354090a5be2a

See more details on using hashes here.

Provenance

File details

Details for the file py_valorant-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: py_valorant-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 29.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.0

File hashes

Hashes for py_valorant-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3ce34eb548fe27ff4648925a19d9aaedb2b277830d5502bc16e9d647557f744c
MD5 e7e3c31d1f711060077c5acc17fb763b
BLAKE2b-256 a569b75e99c65bf6446cd10d9161efd165197cead4d2efcb9525a32701b8fdb2

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page