Skip to content

Commit

Permalink
Detect captcha requirement, fixes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
datagutten committed Sep 7, 2024
1 parent dedddec commit 7a3895f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apc_smartconnect/APCSmartConnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ def get_redirect(self, page, prefix=None):

def get_meta_redirect(self, page):
matches = re.search(r'<meta name="Location" content="(.+?)"', page)
if not matches and page.find('captcha.error') > -1:
raise RuntimeError('Captcha required')
url = matches.group(1)
return self.session.get(url)

Expand Down

0 comments on commit 7a3895f

Please sign in to comment.