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.1.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

py_valorant-1.0.1-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: py-valorant-1.0.1.tar.gz
  • Upload date:
  • Size: 2.2 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.1.tar.gz
Algorithm Hash digest
SHA256 ba73495696d9051c955d121d0d80edb67a5ea2759fcb3b29bbd16855d21b514a
MD5 7ba20eacd58392413dbd6ab6605b9d7e
BLAKE2b-256 e5ea62a81cd250a9f98b97ed7509f203d7297bcc979465c801ce39b07b99d26d

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: py_valorant-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.9 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1367f4a7f7873e61ec8018b5b8a0dac77aba0ac64eeccce6da45849d0d5dc56e
MD5 705531c559cdee16ca0321ee5fb5babb
BLAKE2b-256 70fcd3849425483224c7bffd597d8896df1c872a0eb1127918b17ed7ad0bd1e4

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