Skip to main content

eternalreturn

Unofficial Python SDK for the Eternal Return Open API. Built with aiohttp, with async and sync clients, typed dataclass models, pagination, and automatic rate-limit retries. Requires Python 3.11+.

Installation

Using uv:

uv add eternalreturn

Or with pip:

pip install eternalreturn

Get an API key from the developer portal and set the ETERNALRETURN_API_KEY environment variable before running the examples.

Async

import asyncio
import os

from eternalreturn import EternalReturn


async def main() -> None:
    async with EternalReturn(os.environ["ETERNALRETURN_API_KEY"]) as client:
        response = await client.get_user("Player")
        if response.user is not None:
            games = await client.get_user_games(response.user.uid)
            for game in games.user_games or []:
                print(game.game_id, game.game_rank)


asyncio.run(main())

Sync

import os

from eternalreturn import EternalReturn

with EternalReturn.sync(os.environ["ETERNALRETURN_API_KEY"]) as client:
    response = client.get_user("Player")
    if response.user is not None:
        print(response.user.uid)

Use the async client inside an event loop. Context managers close owned sessions; sessions supplied through session= remain owned by the caller.

Pagination

Use a UID from get_user() while the client is open:

async with client.user_games(uid) as pages:
    async for page in pages:
        for game in page.user_games or []:
            print(game.game_id)

For manual paging, await pages.next() returns a page or None when exhausted. With a sync client, use with, for, and pages.next(). Failed requests preserve the cursor for retry. Missing or null userGames raises InvalidResponseError; an empty list ends pagination normally.

Behavior

  • Responses use typed dataclasses with snake_case fields. Unknown fields are preserved in .extra, and designated JSON string fields are decoded automatically.
  • Clients support users, matches, rankings, statistics, union teams, game data, localization URLs, and recommended routes.
  • Defaults: timeout=30.0, request_interval=1.0, max_retries=3. Rate-limit retries honor Retry-After and share a cooldown within each client. Retry waits are outside the per-request timeout.
  • Transport, API, and decoding failures inherit from EternalReturnError. ModelDecodeError also inherits from ValueError and exposes the failing .path.

Development

uv sync --locked
uv run pytest
uv run ruff check .
uv run ruff format --check .
uv run mypy
uv run pyright
uv build

License

MIT

Metadata

Release files for eternalreturn 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eternalreturn 0.1.0
File Size Uploaded Provenance
eternalreturn-0.1.0.tar.gz 33.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for eternalreturn 0.1.0
File Interpreter ABI Platform
eternalreturn-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 74.9 kB

Release files / eternalreturn-0.1.0.tar.gz

Download URL eternalreturn-0.1.0.tar.gz
Size 33.6 kB
Tags Source
SHA-256 checksum
How to use checksums
399ad76b313e6e8681ca8d0c9813a26d7f69eb2292da8bd8659d0944b5edecd0
BLAKE2b-256 checksum
How to use checksums
19b88ccee805220a73fdd07dd11f376f2be254eaa12c7b13fc0543d6b6792c3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.22

Release files / eternalreturn-0.1.0-py3-none-any.whl

Download URL eternalreturn-0.1.0-py3-none-any.whl
Size 41.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
799572488df111d9854da12466e55fd0d62128108d9b4d34917f21f03882f1bb
BLAKE2b-256 checksum
How to use checksums
33f3f58ebaae4243fdf8d2e106cfb74ad8a293d245dd0d046e25d7bda4e3cc5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.22

Security for eternalreturn 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page