Skip to content

Commit ab6ae9f

Browse files
committed
prevent saving submit failure when unauthenticated
1 parent 3df06da commit ab6ae9f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

aocd/models.py

+3
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,9 @@ def _submit(self, value, part, reopen=True, quiet=False):
559559
log.error(response.data.decode(errors="replace"))
560560
raise AocdError(f"HTTP {response.status} at {url}")
561561
soup = _get_soup(response.data)
562+
if soup(string="[Log In]"):
563+
log.warning("Can't submit when unauthenticated")
564+
raise DeadTokenError(f"the auth token ...{self.user.token[-4:]} is dead")
562565
message = soup.article.text
563566
self._save_submit_result(value=value, part=part, message=message, when=when)
564567
color = None

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "advent-of-code-data"
7-
version = "2.0.2"
7+
version = "2.0.3"
88
description = "Get your puzzle data with a single import"
99
readme = "README.md"
1010
requires-python = ">=3.9"

0 commit comments

Comments
 (0)