Skip to content

Commit f55416b

Browse files
parse - fix error message parsing on notice message
1 parent be113df commit f55416b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

faapi/parse.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ def check_page_raise(page: BeautifulSoup) -> None:
7373
if any(m in error_text for m in not_found_messages):
7474
raise NotFound
7575
else:
76-
raise ServerError(*filter(bool, error_text.splitlines()))
76+
raise ServerError(*filter(bool, map(str.strip, error_text.splitlines())))
7777
elif notice := page.select_one("section.notice-message"):
78-
notice_text: str = p.text.lower() if (p := notice.find("p")) else ""
78+
notice_text: str = notice.text.lower()
7979
if "deactivated" in notice_text:
8080
raise DisabledAccount
8181
elif any(m in notice_text for m in not_found_messages):
8282
raise NotFound
8383
else:
84-
raise NoticeMessage(*filter(bool, notice_text.splitlines()))
84+
raise NoticeMessage(*filter(bool, map(str.strip, notice_text.splitlines())))
8585

8686

8787
def username_url(username: str) -> str:

0 commit comments

Comments
 (0)