# Type-Safe Syncronous and Asyncronous Python wrapper for <a href='https://valorant-api.com/'>Valorant-API.com</a>
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
```py
#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
```py
#Sync
agents = api.agent.fetch_all()
#Async
agents = await api.agent.fetch_all()
```
###### Parameters
- `is_playable_character` **Optional[bool]** - Defualts to `False`
- According to https://dash.valorant-api.com/endpoints/agents set this to `True` to remove possible duplicates
- `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
```py
for agent in agents:
print(str(agent)) # agent.display_name also works
```
### Convert a URL to bytes
```py
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`
Raw data
{
"_id": null,
"home_page": "https://github.com/UnaPepsi/valorant-api-python",
"name": "py-valorant",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "valorant, api, valorant-api, valorant-api.com, py-valorant",
"author": "Guimx",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/07/8a/fb3f907ee3596468fb5a14eed1b51b236ef24399cc72a4fb354090a5be2a/py-valorant-1.0.2.tar.gz",
"platform": null,
"description": "# Type-Safe Syncronous and Asyncronous Python wrapper for <a href='https://valorant-api.com/'>Valorant-API.com</a>\r\n\r\nThis library supports both **sync**, and **async** for its endpoints, is **type-checked** and supports **caching**\r\n\r\n## Installation\r\n```\r\npip install -U py-valorant\r\n```\r\n\r\n## Quick start\r\nThis API does not require any type of authentication key.\r\n\r\nEach endpoint object is documented.\r\n\r\nFirst, initialize a `ValorantAPI` or `ValorantAPIAsync` object\r\n```py\r\n#Sync\r\nfrom py_valorant import ValorantAPI\r\n\r\napi = ValorantAPI()\r\n#Async\r\nfrom py_valorant import ValorantAPIAsync\r\n\r\napi = ValorantAPIAsync()\r\n```\r\n\r\n###### Parameters\r\n- `language` **Optional[LANGUAGE]** - Defualts to `'en-US'`\r\n - The language of the supported returned strings (`localized` in the API).\r\n\r\nThen you access any of the **attributes** inside that object. For this example, we'll use the `agent` attribute\r\n\r\n### Fetch every agent\r\n```py\r\n#Sync\r\nagents = api.agent.fetch_all()\r\n#Async\r\nagents = await api.agent.fetch_all()\r\n```\r\n\r\n###### Parameters\r\n- `is_playable_character` **Optional[bool]** - Defualts to `False`\r\n - According to https://dash.valorant-api.com/endpoints/agents set this to `True` to remove possible duplicates\r\n- `cache` **Optional[bool]** - Defualts to `False`\r\n - If `True` returns values saved in cache and if not found it fetches normally and saves to cache\r\n - If `False` removes the values previously cached by this method and its used parameters and fetches normally without caching\r\n###### Returns\r\n- `List[Agent]`\r\n\r\nNow let's print to the console all the Agents' display name\r\n```py\r\nfor agent in agents:\r\n print(str(agent)) # agent.display_name also works\r\n```\r\n\r\n### Convert a URL to bytes\r\n```py\r\nfrom py_valorant.utils import url_to_bytes\r\n\r\ndownloaded = url_to_bytes('https://exampleimage.com/image.png')\r\n```\r\n###### Parameters\r\n- `url` **str**\r\n - The URL of the resource to convert\r\n- `run_thread` **Optional[bool]** - Defualts to `False`\r\n - Whether to run the function in a new Thread\r\n###### Returns\r\n- `BytesIO`\r\n\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python Wrapper for valorant-api.com",
"version": "1.0.2",
"project_urls": {
"Homepage": "https://github.com/UnaPepsi/valorant-api-python"
},
"split_keywords": [
"valorant",
" api",
" valorant-api",
" valorant-api.com",
" py-valorant"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a569b75e99c65bf6446cd10d9161efd165197cead4d2efcb9525a32701b8fdb2",
"md5": "e7e3c31d1f711060077c5acc17fb763b",
"sha256": "3ce34eb548fe27ff4648925a19d9aaedb2b277830d5502bc16e9d647557f744c"
},
"downloads": -1,
"filename": "py_valorant-1.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e7e3c31d1f711060077c5acc17fb763b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 29531,
"upload_time": "2024-08-07T01:11:14",
"upload_time_iso_8601": "2024-08-07T01:11:14.878343Z",
"url": "https://files.pythonhosted.org/packages/a5/69/b75e99c65bf6446cd10d9161efd165197cead4d2efcb9525a32701b8fdb2/py_valorant-1.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "078afb3f907ee3596468fb5a14eed1b51b236ef24399cc72a4fb354090a5be2a",
"md5": "1bdc2f426f73c9fed0d8ba6f0ce7d34b",
"sha256": "8b4ef83818edb5a8a113f914a16accd2834d94406278c4f08be90e6fd38e02c0"
},
"downloads": -1,
"filename": "py-valorant-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "1bdc2f426f73c9fed0d8ba6f0ce7d34b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 19251,
"upload_time": "2024-08-07T01:11:16",
"upload_time_iso_8601": "2024-08-07T01:11:16.479392Z",
"url": "https://files.pythonhosted.org/packages/07/8a/fb3f907ee3596468fb5a14eed1b51b236ef24399cc72a4fb354090a5be2a/py-valorant-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-07 01:11:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "UnaPepsi",
"github_project": "valorant-api-python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "py-valorant"
}