Skip to content

Commit

Permalink
Basic success-testing on logins
Browse files Browse the repository at this point in the history
  • Loading branch information
kemayo committed May 15, 2024
1 parent ef9309e commit 53727fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 5 additions & 2 deletions sites/ao3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion sites/xenforo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 53727fd

Please sign in to comment.