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
languageOptional[LANGUAGE] - Defualts to'en-US'- The language of the supported returned strings (
localizedin the API).
- The language of the supported returned strings (
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_characterOptional[bool] - Defualts toFalse- According to https://dash.valorant-api.com/endpoints/agents set this to
Trueto remove possible duplicates
- According to https://dash.valorant-api.com/endpoints/agents set this to
cacheOptional[bool] - Defualts toFalse- If
Truereturns values saved in cache and if not found it fetches normally and saves to cache - If
Falseremoves the values previously cached by this method and its used parameters and fetches normally without caching
- If
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
urlstr- The URL of the resource to convert
run_threadOptional[bool] - Defualts toFalse- Whether to run the function in a new Thread
Returns
BytesIO
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b4ef83818edb5a8a113f914a16accd2834d94406278c4f08be90e6fd38e02c0
|
|
| MD5 |
1bdc2f426f73c9fed0d8ba6f0ce7d34b
|
|
| BLAKE2b-256 |
078afb3f907ee3596468fb5a14eed1b51b236ef24399cc72a4fb354090a5be2a
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ce34eb548fe27ff4648925a19d9aaedb2b277830d5502bc16e9d647557f744c
|
|
| MD5 |
e7e3c31d1f711060077c5acc17fb763b
|
|
| BLAKE2b-256 |
a569b75e99c65bf6446cd10d9161efd165197cead4d2efcb9525a32701b8fdb2
|