mirror of
https://github.com/kemayo/leech
synced 2025-12-06 08:22:56 +01:00
Add a bit more messaging around logging in to sites
This commit is contained in:
parent
5bfd1b40a0
commit
6fddf628fb
2 changed files with 20 additions and 16 deletions
1
leech.py
1
leech.py
|
|
@ -108,6 +108,7 @@ def open_story(site, url, session, login, options):
|
|||
)
|
||||
|
||||
if login:
|
||||
logger.info("Attempting to log in as %s", login[0])
|
||||
handler.login(login)
|
||||
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ class ArchiveOfOurOwn(Site):
|
|||
|
||||
def login(self, login_details):
|
||||
with requests_cache.disabled():
|
||||
try:
|
||||
# Can't just pass this url to _soup because I need the cookies later
|
||||
login = self.session.get('https://archiveofourown.org/users/login')
|
||||
soup, nobase = self._soup(login.text)
|
||||
|
|
@ -37,6 +38,8 @@ class ArchiveOfOurOwn(Site):
|
|||
logger.info("Logged in as %s", login_details[0])
|
||||
else:
|
||||
logger.error("Failed to log in as %s", login_details[0])
|
||||
except Exception as e:
|
||||
logger.error("Failed to log in as %s, but so hard that it threw an exception %s", login_details[0], e)
|
||||
|
||||
def extract(self, url):
|
||||
workid = re.match(r'^https?://(?:www\.)?archiveofourown\.org/works/(\d+)/?.*', url).group(1)
|
||||
|
|
|
|||
Loading…
Reference in a new issue