Skip to main content

API Reference

Puzzle inputs and answers

get_puzzle_input()

Retrieve the raw puzzle input for a specific Advent of Code puzzle.

submit_puzzle_answer()

Submit an answer for a specific puzzle part.

SubmissionResult

Outcome of an answer attempt or a local submission guardrail.

Progress and leaderboards

get_user_status()

Retrieve the user’s Advent of Code progress for the specified year.

get_private_leaderboard()

Retrieve a private leaderboard for a given year.

DayStatus

Calendar entry for one puzzle day.

YearStatus

Advent of Code calendar and account summary for an event page.

Leaderboard

Private leaderboard and its members for one Advent of Code event.

OutputFormat

Output formats for status and leaderboard queries.

Puzzle helpers

helpers.parse_input()

Split text at line boundaries, retaining whitespace within each line.

helpers.read_input()

Read a UTF-8 input file and strip leading and trailing whitespace.

helpers.timer()

Create a decorator that reports elapsed time on successful calls.

Submission and leaderboard models

models.SubmissionStatus

Outcomes used in submission results and cached guess history.

models.Member

One participant on a private leaderboard.

models.StarCompletion

Completion of one part of a puzzle by a leaderboard member.

Exceptions

exceptions.ElfError

Base exception for elf package errors.

exceptions.MissingSessionTokenError

Raised when the Advent of Code session token is missing.

exceptions.PuzzleLockedError

Raised when a puzzle has yet to unlock in America/New_York.

exceptions.InputFetchError

Raised when there is an issue fetching the puzzle input.

exceptions.SubmissionError

Raised when there is an issue submitting the answer.

exceptions.LeaderboardFetchError

Raised when there is an issue fetching a private leaderboard.

exceptions.StatusFetchError

Raised when there is an issue fetching a user’s status page.