Asynchronous python interface for <OPENDOTA/> API
Project description
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 API in a project BUT WITH ASYNCHRONICITY
from aiota2 import AioClient
import asyncio
async def main():
# Initalize API interface object
dota = AioClient()
asyncio.run(main=main())
Get player / match / team / heroes
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
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"
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:
dota.heroes
dota.get_hero_by_param(param: str, value: Any)
dota.get_heroes_by_param(param: str, value: Any)
DataModel
Using DataModel
from aiota2 import AioClient
import asyncio
async def main():
# Initalize API interface object
dota = AioClient(with_models=True)
asyncio.run(main=main())
>>> answer = await dota.get_player(player_id: int)
<DataModel of Player at address>
>>> answer.rank_tier
0
Deepening
Creating DataModel
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.
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
aiota2-1.0.2.tar.gz
(7.2 kB
view hashes)
Built Distribution
aiota2-1.0.2-py3-none-any.whl
(7.2 kB
view hashes)