Skip to content

Commit

Permalink
add user agent header
Browse files Browse the repository at this point in the history
  • Loading branch information
Spacerulerwill committed Jan 10, 2025
1 parent 667f69d commit b5a5f08
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion aoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
def puzzle(input: str) -> Any: ...
"""

HEADERS = {
"User-Agent": "https://github.com/Spacerulerwill/aoc by [email protected]"
}


def init_puzzle(year: int, day: int, part: int, force: bool) -> None:
folder_path = os.path.join(PUZZLE_LOCATION, f"Y{year}", f"D{day}")
Expand Down Expand Up @@ -47,7 +51,7 @@ def run_puzzle(year: int, day: int, part: int, aoc_session_cookie: str) -> None:
if not os.path.isfile(input_path):
cookies = {"session": aoc_session_cookie}
r = requests.get(
f"https://adventofcode.com/{year}/day/{day}/input", cookies=cookies
f"https://adventofcode.com/{year}/day/{day}/input", cookies=cookies, headers=HEADERS
)
r.raise_for_status()
input = r.text
Expand Down

0 comments on commit b5a5f08

Please sign in to comment.