| Name | aiota2 JSON |
| Version |
1.0.2
JSON |
| download |
| home_page | None |
| Summary | Asynchronous python interface for <OPENDOTA/> API |
| upload_time | 2024-08-25 00:17:12 |
| maintainer | None |
| docs_url | None |
| author | flsoap |
| requires_python | >=3.8 |
| license | None |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# AioTA2

Asynchronous python interface for \<OPENDOTA/> API
## Features
* A function for each API call
* Asynchrony support
* Allows API keys authentication
* Abstract Models class
## Usage
### Use <OPENDOTA/> API in a project BUT WITH ASYNCHRONICITY
```python
from aiota2 import AioClient
import asyncio
async def main():
# Initalize API interface object
dota = AioClient()
asyncio.run(main=main())
```
Get player / match / team / heroes
```python
await dota.get_player(account_id: int)
await dota.get_match(match_id: int)
await dota.get_team(team_id: int)
await dota.get_heroes()
```
### Query Params
```python
await dota.search_player_by_personaname(**query_params)
await dota.find_matches(**query_params)
await dota.get_teams(**query_params)
# ...
```
### Hero attribute
That give you ability to access the dota heroes base without sending a request to API many times, just use object attribute "heroes"
```python
from aiota2 import AioClient
import asyncio
async def main():
# Initalize API interface object with heroes attribute
dota = await AioClient().load_heroes() # Pay attention to await
# load_heroes() is dota.heroes = await get_heroes()
asyncio.run(main=main())
```
So that allows you:
```python
dota.heroes
dota.get_hero_by_param(param: str, value: Any)
dota.get_heroes_by_param(param: str, value: Any)
```
### DataModel
Using DataModel
```python
from aiota2 import AioClient
import asyncio
async def main():
# Initalize API interface object
dota = AioClient(with_models=True)
asyncio.run(main=main())
```
```python
>>> answer = await dota.get_player(player_id: int)
<DataModel of Player at address>
>>> answer.rank_tier
0
```
#### Deepening
Creating DataModel
```python
from aiota2 import DataModel
colors = {
"sky": "blue",
"grass": "green"
}
model = DataModel("colors", colors)
```
## About OpenDota API
The OpenDota API provides Dota 2 related data including advanced match data extracted from match replays.
OpenDota API Documentation: https://docs.opendota.com/
## Credits
This package uses data provided by The OpenDota API.
Raw data
{
"_id": null,
"home_page": null,
"name": "aiota2",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": "flsoap",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/e6/17/b3c2b5d00c7e00ed4e9a2691589e52b2fc5373e5ded8eb9bee08c640534c/aiota2-1.0.2.tar.gz",
"platform": null,
"description": "# AioTA2\r\n\r\n\r\nAsynchronous python interface for \\<OPENDOTA/> API\r\n## Features\r\n* A function for each API call\r\n* Asynchrony support\r\n* Allows API keys authentication\r\n* Abstract Models class\r\n## Usage\r\n### Use <OPENDOTA/> API in a project BUT WITH ASYNCHRONICITY\r\n```python\r\nfrom aiota2 import AioClient\r\nimport asyncio\r\n\r\nasync def main():\r\n # Initalize API interface object\r\n dota = AioClient()\r\n\r\nasyncio.run(main=main())\r\n```\r\nGet player / match / team / heroes\r\n```python\r\nawait dota.get_player(account_id: int)\r\nawait dota.get_match(match_id: int)\r\nawait dota.get_team(team_id: int)\r\nawait dota.get_heroes()\r\n```\r\n### Query Params\r\n```python\r\nawait dota.search_player_by_personaname(**query_params)\r\nawait dota.find_matches(**query_params)\r\nawait dota.get_teams(**query_params)\r\n# ...\r\n```\r\n### Hero attribute\r\nThat give you ability to access the dota heroes base without sending a request to API many times, just use object attribute \"heroes\"\r\n```python\r\nfrom aiota2 import AioClient\r\nimport asyncio\r\n\r\nasync def main():\r\n # Initalize API interface object with heroes attribute\r\n dota = await AioClient().load_heroes() # Pay attention to await\r\n # load_heroes() is dota.heroes = await get_heroes()\r\n\r\nasyncio.run(main=main())\r\n```\r\nSo that allows you:\r\n```python\r\ndota.heroes\r\ndota.get_hero_by_param(param: str, value: Any)\r\ndota.get_heroes_by_param(param: str, value: Any)\r\n```\r\n### DataModel\r\nUsing DataModel\r\n```python\r\nfrom aiota2 import AioClient\r\nimport asyncio\r\n\r\nasync def main():\r\n # Initalize API interface object\r\n dota = AioClient(with_models=True)\r\n\r\nasyncio.run(main=main())\r\n```\r\n```python\r\n>>> answer = await dota.get_player(player_id: int)\r\n<DataModel of Player at address>\r\n>>> answer.rank_tier\r\n0\r\n```\r\n#### Deepening\r\nCreating DataModel\r\n```python\r\nfrom aiota2 import DataModel\r\n\r\ncolors = {\r\n \"sky\": \"blue\",\r\n \"grass\": \"green\"\r\n}\r\n\r\nmodel = DataModel(\"colors\", colors)\r\n```\r\n## About OpenDota API\r\nThe OpenDota API provides Dota 2 related data including advanced match data extracted from match replays.\r\n\r\nOpenDota API Documentation: https://docs.opendota.com/\r\n\r\n## Credits\r\nThis package uses data provided by The OpenDota API.\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Asynchronous python interface for <OPENDOTA/> API",
"version": "1.0.2",
"project_urls": {
"Homepage": "https://github.com/FilinSep/aiota2",
"Issues": "https://github.com/FilinSep/aiota2/issues"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1178b61f12a73896579ab06f0e7dc3eab2fe2977f1561865e7322037196201b7",
"md5": "d62f535fe2da2c545013d32b45852e33",
"sha256": "f139f8fb8ba5cad117c931f83d0eb8f172ab8f846d151c7a5ef18a1de2dcfc87"
},
"downloads": -1,
"filename": "aiota2-1.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d62f535fe2da2c545013d32b45852e33",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 7203,
"upload_time": "2024-08-25T00:17:11",
"upload_time_iso_8601": "2024-08-25T00:17:11.765886Z",
"url": "https://files.pythonhosted.org/packages/11/78/b61f12a73896579ab06f0e7dc3eab2fe2977f1561865e7322037196201b7/aiota2-1.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e617b3c2b5d00c7e00ed4e9a2691589e52b2fc5373e5ded8eb9bee08c640534c",
"md5": "6bae8ff6eab338a429b5a6c13f2c66ad",
"sha256": "24bae9f594f1b66a55ab5911c310d583cc93d086a96082f4378dceac5bdf3cbe"
},
"downloads": -1,
"filename": "aiota2-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "6bae8ff6eab338a429b5a6c13f2c66ad",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 7151,
"upload_time": "2024-08-25T00:17:12",
"upload_time_iso_8601": "2024-08-25T00:17:12.998895Z",
"url": "https://files.pythonhosted.org/packages/e6/17/b3c2b5d00c7e00ed4e9a2691589e52b2fc5373e5ded8eb9bee08c640534c/aiota2-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-25 00:17:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "FilinSep",
"github_project": "aiota2",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "aiota2"
}