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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file aiota2-1.0.2.tar.gz.

File metadata

  • Download URL: aiota2-1.0.2.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for aiota2-1.0.2.tar.gz
Algorithm Hash digest
SHA256 24bae9f594f1b66a55ab5911c310d583cc93d086a96082f4378dceac5bdf3cbe
MD5 6bae8ff6eab338a429b5a6c13f2c66ad
BLAKE2b-256 e617b3c2b5d00c7e00ed4e9a2691589e52b2fc5373e5ded8eb9bee08c640534c

See more details on using hashes here.

File details

Details for the file aiota2-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: aiota2-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for aiota2-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f139f8fb8ba5cad117c931f83d0eb8f172ab8f846d151c7a5ef18a1de2dcfc87
MD5 d62f535fe2da2c545013d32b45852e33
BLAKE2b-256 1178b61f12a73896579ab06f0e7dc3eab2fe2977f1561865e7322037196201b7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page