diff --git a/pyproject.toml b/pyproject.toml index 5798161..dd36407 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "opower" -version = "0.3.0" +version = "0.3.1" license = {text = "Apache-2.0"} authors = [ { name="tronikos", email="tronikos@gmail.com" }, diff --git a/src/opower/utilities/aepbase.py b/src/opower/utilities/aepbase.py index 1eae67c..9732065 100644 --- a/src/opower/utilities/aepbase.py +++ b/src/opower/utilities/aepbase.py @@ -121,9 +121,15 @@ async def async_login( headers={"User-Agent": USER_AGENT}, raise_for_status=True, ) as resp: - login_parser.feed(await resp.text()) + text = await resp.text() + login_parser.feed(text) + if not login_parser.password_field_found: + match = re.search(r"https://([^.]*).opower.com", text) + assert match + cls._subdomain = match.group(1) + # Assume we are already logged in return