Skip to main content

Retrieve and decrypt puzzle input data for everybody.codes events

Project description

pypi actions codecov womm

Everybody Codes Data

This library is used to decrypt input notes for everybody.codes events.

Install

pip install everybody-codes-data

Auth

Your auth token should be placed at ~/.config/ecd/token or defined in the ECD_TOKEN environment variable. Get the token from the "Session Cookie" section on your profile.

Usage

There is a getter function ecd.get_inputs which accepts the quest and event, and returns a dict of your decrypted data. The dict will have string keys "1", "2", "3" corresponding to the puzzle parts. Inputs are unlocked as you complete subsequent parts, so the dict will have only the key "1" initially.

>>> from ecd import get_inputs
>>> data = get_inputs(quest=3, event=2024)
>>> print(data["1"])
..............................
..............................
.............#................
.............##.#...#.........
..........#.#####...###.......
..........#########.#.........
.........############.........
.........##############.......
.........#############........
..........##.###.##...........
...........#...#.#............
...........#..................
..............................
..............................

There is also a CLI:

$ ecd 3 2024 --part 1
..............................
..............................
.............#................
.............##.#...#.........
..........#.#####...###.......
..........#########.#.........
.........############.........
.........##############.......
.........#############........
..........##.###.##...........
...........#...#.#............
...........#..................
..............................
..............................

See ecd --help for more info on that.

Submission

everybody-codes-data can also post answers.

from ecd import submit
submit(quest=1, event=2024, part=1, answer=1323)

If you don't want the submission result printed to the terminal, pass quiet=True.

The result of the submission will be logged (so you may want to configure the logging framework in your project), but if you want to see the result explicitly the return value here is just a urllib3.HTTPResponse instance.

from ecd import submit
result = submit(quest=1, event=2024, part=1, answer=1323, quiet=True)
print(result.status)
print(result.json())

Import interface

There is also a "magic" interface, similar to advent-of-code-data, where you can use a direct import statement. To use this feature, you must structure your directories and filenames like ec{event}/q{quest}.py in order that the library can introspect the event/quest from the path. For example, this structure should work:

my-repo/ec2024/q01.py    (event=2024, quest=1) 
my-repo/ec2024/q02.py    (event=2024, quest=2)
my-repo/ec2025/q01.py    (event=2025, quest=1)

Then in your script, the dict of data will be populated from an import statement:

from ecd import data

If you don't want to use this directory structure, call the ecd.get_inputs() function directly instead of using the import syntax. The getter function has no restrictions on script, module or package names.

Caching

This library will cache inputs to avoid hitting the server unnecessarily. Your input data will only be cached locally once all three parts can be decrypted (i.e. once you've solved part 1 and part 2). There is no caching for partial solves. Caches are stored at ~/.config/ecd in JSON format, they can be safely removed anytime.

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

everybody_codes_data-0.6.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

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

everybody_codes_data-0.6-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file everybody_codes_data-0.6.tar.gz.

File metadata

  • Download URL: everybody_codes_data-0.6.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for everybody_codes_data-0.6.tar.gz
Algorithm Hash digest
SHA256 fa32bd766adb185a296cd28f42cc57f729eb7ca4f499fe1aab93b9a6a214ece1
MD5 535c9ccb016be79359ab00b38751c86b
BLAKE2b-256 bf954e5b53ef15ba73600abcde3624facac461d1bbcfa7943d7e44dbe2e3638f

See more details on using hashes here.

File details

Details for the file everybody_codes_data-0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for everybody_codes_data-0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 dfe71660650026d22c4f7be85d60f9aad3c45a6c4722f0da7d32ecd4048d0a41
MD5 0edfb59a2002e45ca338246f14e733de
BLAKE2b-256 7659ea86fa6a89e108aee150b035c48c2aef84ea67c899022b640cd9161dc9e1

See more details on using hashes here.

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