Skip to main content

Asynchronous python interface for <OPENDOTA/> API

Project description

AioTA2

enter image description hereenter image description hereenter image description hereenter image description here

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


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)

Uploaded Source

Built Distribution

aiota2-1.0.2-py3-none-any.whl (7.2 kB view hashes)

Uploaded Python 3

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