dota2cl: an OpenDota API client

A portable Python client and command line for the OpenDota API that builds reports as YAML or HTML, for example dota2cl -f html top_teams.html.

Design

  • An extensible client class with simple time-based caching of requests.
  • Endpoints are checked against the API's OpenAPI schema; the base API class can be reused for other OpenAPI services.
  • Reports are subclasses that override generate_payload() and html_body(), with optional Jinja2 templates.
  • Layered configuration: defaults, then a config file, then DOTA2CL_* environment variables, then the command line.
  • Versions come from git tags; Semantic Versioning and Keep a Changelog.

One finding: OpenDota's proPlayers data disagrees with its teams data (many players have team_id 0), so there is an optional team lookup by name (--preload-teams).

Unit tests, coverage and profiling scripts; Python 3.10 or later; MIT licence.