1
0
Fork 0
mirror of synced 2026-12-06 18:52:25 +00:00
No description
Find a file
Parker Wahle 2d0f63be68
Refuse a TODO or FIXME without its issue in pre-commit
A local pygrep hook, todo-needs-issue: a TODO or FIXME is written TODO(#N), naming its GitHub issue, under regulad/skills' Tracking work rule. It skips Markdown and this config.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mv4cZ2TAgLi4RirGrVaqXv
2026-11-22 20:55:11 -05:00
.github Extend the shared settings from regulad/.github 2026-11-22 11:06:05 -05:00
src/aiosplatoon2ink Add an asyncio client and pydantic models for splatoon2.ink's feeds 2026-11-16 05:52:15 -05:00
tests Add an asyncio client and pydantic models for splatoon2.ink's feeds 2026-11-16 05:52:15 -05:00
.gitignore Add an asyncio client and pydantic models for splatoon2.ink's feeds 2026-11-16 05:52:15 -05:00
.pre-commit-config.yaml Refuse a TODO or FIXME without its issue in pre-commit 2026-11-22 20:55:11 -05:00
LICENSE Add an asyncio client and pydantic models for splatoon2.ink's feeds 2026-11-16 05:52:15 -05:00
poetry.lock Add an asyncio client and pydantic models for splatoon2.ink's feeds 2026-11-16 05:52:15 -05:00
pyproject.toml Add an asyncio client and pydantic models for splatoon2.ink's feeds 2026-11-16 05:52:15 -05:00
README.md Add an asyncio client and pydantic models for splatoon2.ink's feeds 2026-11-16 05:52:15 -05:00

aiosplatoon2ink

An asyncio client for the Splatoon 2 data that splatoon2.ink publishes, with typed, immutable pydantic models of each feed. It's the Splatoon 2 sibling of aiosplatoon3ink.

from datetime import UTC, datetime

from aiosplatoon2ink import Splatoon2InkClient
from aiosplatoon2ink.schedules import GameMode

async with Splatoon2InkClient("MyBot/1.0 (+https://github.com/me/mybot)") as client:
    schedules = await client.schedules()

now = datetime.now(UTC)
rotation = next(rotation for rotation in schedules.in_mode(GameMode.RANKED) if rotation.is_active(now))
print(rotation.rule.name, [stage.name for stage in rotation.stages], rotation.stage_a.image.url)

Feeds

Method Feed Returns
schedules() schedules.json Every Regular, Ranked and League Battle rotation for about a day
salmon_run() coop-schedules.json Salmon Run rotations, with the stage and weapons of the next two
gear() merchandises.json Gear on sale at SplatNet 2's shop
festivals() festivals.json Every Splatfest and its results, in each of the three regions
festival_rankings(region, festival_id) festivals/<region>-<festival_id>-rankings.json The top 100 players of each team in a Splatfest
timeline() timeline.json The month's Salmon Run reward gear, and weapons released in the last few days

The models keep SplatNet 2's field names, which are already snake_case. Where SplatNet's internal names differ from the game's, the enums use the game's: GameMode.RANKED is "gachi", and GearKind.CLOTHING is "clothes". Each image is an Image, whose url is splatoon2.ink's copy of it. Fields the models don't know are ignored. Each method raises aiohttp.ClientError when a request fails, and pydantic.ValidationError when a feed has a shape the models don't expect.

The translations under data/locale/ aren't modelled yet.

Using splatoon2.ink's data

splatoon2.ink's terms ask that you:

  • credit splatoon2.ink wherever you show its data;
  • cache the feeds rather than fetch them more often than once an hour, since that's how often they update;
  • send a User-Agent that says how to reach you, which the client requires;
  • avoid hotlinking its images and data from a very busy site;
  • keep whatever you build free of charge.

Installing

It isn't on PyPI. Install it from git, pinned to a commit:

poetry add "git+https://github.com/regulad/aiosplatoon2ink.git#<commit>"

Developing

poetry install --with type
poetry run pytest              # against the snapshots in tests/fixtures
poetry run pytest -m live      # against splatoon2.ink's feeds as they are now
poetry run mypy src tests
poetry run pre-commit run --all-files

License

AGPL-3.0. The data belongs to Nintendo, and reaches you through SplatNet 2 and splatoon2.ink.