Skip to main content

Utility library for Advent of Code (https://adventofcode.com)

Project description

AoC Utils

This small library can be used for the yearly Advent of Code (https://adventofcode.com) challenge. It automates the retrieval of puzzle input and submission.

Installation

aocutil is published on PyPi and can be installed from there.

Usage

from aocutil import Aoc

# Initialize for year 2022, day 1 with session id 53616c746
#
# Everything here is optional. If left out year and day is determined
# from the current date -- be aware that your code is non-repeatable if year 
# and date is not specified.
# Session id is read from `${HOME}/.config/aocutil/session_id` if not specified.
aoc = Aoc(year=2022, day=1, session_id="53616c746")

# Retrieve input and split into list of lines
#
# You can also retrieve the content as a string with `aoc.input().read()`.
puzzle = aoc.input().lines()

# solve the puzzle (your implementation)
solution = solve(puzzle)

# Submit the solution for level 1
#
# If left out, the level is determined automatically by
# which level is not solved yet.
aoc.submit(solution, level=1)

Retrieving the Session ID

A user in Advent of Code submissions and input retrieval is determined by a session id stored in a cookie in the user's browser. For this library to work it needs a users session id. The session id can be found by opening your browsers developer tools and looking for a cookie named session.

You can either initialize Aoc with the token or store it in a file named ${HOME}/.config/aocutil/session_id. I would recommend the latter so you don't accidentially publish your session id. Note that everyone who gets hold of your session id can impersonate you.

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

aocutil-0.1.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

aocutil-0.1.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aocutil-0.1.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.8 Linux/6.0.10-arch2-1

File hashes

Hashes for aocutil-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a627367caf16181ff263c1f5c4d93ddf14ab4660dc2d0d4a58022b494f86fbe6
MD5 c608cc084ebd578c462d574ac440784d
BLAKE2b-256 ee26c612b983c0d9dce4efc70e4b6b450f37570434676d20d0a9a8f711a6ffca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aocutil-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.8 Linux/6.0.10-arch2-1

File hashes

Hashes for aocutil-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad0d3d3431c6adfd1e4d85fc2ffa917ef93708c71d32d6f9b97d987f15b4eb80
MD5 5f43f0fef560504dc6384dbe4431d638
BLAKE2b-256 d46c63a19e4a1d7a14494ffd4d7dffed2f24f31408f407819749a198d4b319b2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page