From 082c61beca0a69ba5837a84f3b80c770d276ee65 Mon Sep 17 00:00:00 2001 From: Stefan Harmuth Date: Tue, 28 Dec 2021 12:51:26 +0100 Subject: [PATCH] auto input-download and answer-submit --- tools/aoc.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/aoc.py b/tools/aoc.py index e465131..85e2dc7 100644 --- a/tools/aoc.py +++ b/tools/aoc.py @@ -84,10 +84,10 @@ class AOCDay: "https://adventofcode.com/%d/day/%d/input" % (self.year, self.day), cookies={'session': session_id} ) - print(response) - print(response.content) - if response.status_code != 200: - print("FAIL") + if not response.ok: + print("FAILED to download input: (%s) %s" % (response.status_code, response.text)) + return + with open(filename, "wb") as f: f.write(response.content) f.flush()