diff --git a/sites/ao3.py b/sites/ao3.py index b672e06..6d0e905 100644 --- a/sites/ao3.py +++ b/sites/ao3.py @@ -29,11 +29,14 @@ def login(self, login_details): post['user[password]'] = login_details[1] # I feel the session *should* handle this cookies bit for me. But # it doesn't. And I don't know why. - self.session.post( + result = self.session.post( self._join_url(login.url, action), data=post, cookies=login.cookies ) - logger.info("Logged in as %s", login_details[0]) + if result.ok: + logger.info("Logged in as %s", login_details[0]) + else: + logger.error("Failed to log in as %s", login_details[0]) def extract(self, url): workid = re.match(r'^https?://(?:www\.)?archiveofourown\.org/works/(\d+)/?.*', url).group(1) diff --git a/sites/xenforo.py b/sites/xenforo.py index 720cf00..4616cbf 100644 --- a/sites/xenforo.py +++ b/sites/xenforo.py @@ -73,7 +73,10 @@ def login(self, login_details): self._join_url(login.url, action), data=post, cookies=login.cookies ) - logger.info("Logged in as %s", login_details[0]) + if result.ok: + logger.info("Logged in as %s", login_details[0]) + else: + logger.error("Failed to log in as %s", login_details[0]) def extract(self, url): soup = self._soup(url)