Skip to main content

A python interface for <OPENDOTA/> API

Project description

https://img.shields.io/pypi/v/pyopendota?color=success Documentation Status Python Version Support GitHub Issues GitHub Followers Twitter Followers

A python interface for <OPENDOTA/> API

The OpenDota class provided with the package serves as a python interface for the original OpenDota API in the form of a thin wrapper. The class assumes some familiarity with the OpenDota API.

All method calls return serializable python objects, as return by the API, in most cases a dict or a list. Response data is stored as JSON in a local directory (Default: ~/dota2), to prevent the load on OpenDota API.

Features

  • Transparent wrapper for majority of the API calls

  • Ability to authenticate using API key

  • In-built and cusomizable limit to protect against frequent API calls

  • Local file-based storage for frequent requests

  • Basic CLI using fire

Usage

Use <OPENDOTA/> API in a project

import opendota

# Initialize the API-connection object
client = opendota.OpenDota()

Get Common Entities

client.get_matches('match-id')
client.get_player('player-id')
client.get_team('team-id')

Search Functionality

players = client.search_player('Dendi')
teams = client.search_team('Alliance')
heroes = client.search_hero('Crystal')
leagues = client.search_league('International')

PostgreSQL Query

OpenDota API supports arbitrary PostgreSQL query.

Check Database Schema:

client.get_schema()           # Lists all tables
client.get_schema('matches')  # Lists schema for a specific table

Arbitrary PostgreSQL Query:

client.explorer("select * from matches where limit 1")

Use <OPENDOTA/> API Command Line Interface

Information about OpenDota class initialization:

opendota --help

Information about OpenDota methods:

opendota - --help

Run methods

opendota search_team Virtus
opendota get_match 4080778303

Powered by :code:`fire`

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

History

0.2.0 (2021-10-04)

  • Improved Documentation

  • League specific functions

  • Basic CLI using python-fire

  • Fantasy score calculation

  • Bugfixes

0.1.0 (2021-07-20)

  • First release on PyPI.

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

pyopendota-0.2.9.tar.gz (18.5 kB view hashes)

Uploaded Source

Built Distribution

pyopendota-0.2.9-py2.py3-none-any.whl (10.8 kB view hashes)

Uploaded Python 2 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