Skip to main content

Async Python client for the OverFast API (Overwatch data).

Project description

overfast-client

Async Python client for the OverFast API — comprehensive Overwatch data (heroes, maps, gamemodes, player stats) via a typed, pydantic-backed interface.

Install

pip install overfast-client

The PyPI distribution is overfast-client; the import name is overwatch_py.

Or from source (editable):

pip install -e .

Quick start

import asyncio
from overwatch_py import Client
from overwatch_py.enums import Hero, Locale, Role, HeroGamemode, PlayerGamemode, Platform

async def main():
    client = Client()

    # List heroes
    heroes = await client.get_heroes(role=Role.SUPPORT, locale=Locale.EN_US)
    for h in heroes:
        print(h.key, h.name)

    # Full hero data (abilities, story, hitpoints, ...)
    ana = await client.get_hero_data(Hero.ANA)
    print(ana.hitpoints, len(ana.abilities))

    # Maps & gamemodes
    maps = await client.get_maps()
    gamemodes = await client.get_gamemode_details()

    # Hero usage stats (pickrate / winrate)
    stats = await client.get_heroes_stats(
        platform=Platform.PC,
        gamemode=PlayerGamemode.COMPETITIVE,
    )

    # Players
    result = await client.search_players("TeKrop", limit=10)
    player = await client.get_player(result.results[0].player_id)
    summary = await client.get_player_summary("TeKrop-2217")
    stats_summary = await client.get_player_stats("TeKrop-2217", gamemode=PlayerGamemode.COMPETITIVE)

asyncio.run(main())

Configuration

from overwatch_py import Client
from overwatch_py.config import Config
from overwatch_py.session import HTTPSession

config = Config(
    timeout=10,          # seconds
    retries=3,           # retries on 5xx
    cache=True,          # HTTP-level cache (hishel), respects server Cache-Control
    cache_backend="sqlite",  # "memory" | "sqlite" | "file"
)
client = Client(HTTPSession(config))

Caching

Caching is disabled by default. When enabled, hishel sits in the httpx transport stack and honors each endpoint's Cache-Control / Age headers (e.g. /heroes is cached ~1 day, /heroes/stats ~1 hour by the upstream API).

Exceptions

All non-2xx responses map to subclasses of APIError:

Status Exception
400 BadRequestError
404 NotFoundError
422 ValidationError
429 APIRateLimitError
500 InternalServerError
503 BlizzardRateLimitError
504 BlizzardServerError
from overwatch_py.exceptions import NotFoundError, APIRateLimitError

try:
    await client.get_player_summary("does-not-exist-1234")
except NotFoundError:
    ...
except APIRateLimitError as e:
    print("rate limited:", e.response.headers.get("retry-after"))

API surface

Exposed on Client:

  • Heroesget_heroes, get_hero_data, get_heroes_stats
  • Maps / Gamemodesget_maps, get_gamemode_details
  • Playerssearch_players, get_player, get_player_summary, get_player_stats, get_player_career_stats, get_player_career_stats_with_labels, get_player_full_stats

The underlying services (client.heros, client.maps, client.players) are also available if you prefer service-level access.

Development

pip install -e ".[dev]"
pytest                     # unit + mocked HTTP tests
pytest -m live             # hits the real API (rate-limited)
pytest -m 'live or not live'  # run everything

License

MIT.

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

overfast_client-0.1.0.tar.gz (43.7 kB view details)

Uploaded Source

Built Distribution

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

overfast_client-0.1.0-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file overfast_client-0.1.0.tar.gz.

File metadata

  • Download URL: overfast_client-0.1.0.tar.gz
  • Upload date:
  • Size: 43.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for overfast_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 51f1e5e87e194a18e864d4f63ea02a533a2121079a9d94962ef22239862ee939
MD5 66ff7ad9c5bccb609af61f77da6d6b8b
BLAKE2b-256 34b8bc88d1ab463627897edf0cb0a8b6f9cba9610ca99512194cf84a31759efe

See more details on using hashes here.

Provenance

The following attestation bundles were made for overfast_client-0.1.0.tar.gz:

Publisher: publish.yml on Leo890728/overwatch_py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file overfast_client-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: overfast_client-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for overfast_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 43d1f314448d7f2458b906b5a0605a08e782a8bf74a2df728283951a59f668a7
MD5 ca7e88a1e97660d61e932f879acab13c
BLAKE2b-256 f475549d8ca699919931d0df1d30a597a00ce8e7ef52d96f7a57f34bd53d837d

See more details on using hashes here.

Provenance

The following attestation bundles were made for overfast_client-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Leo890728/overwatch_py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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