jantman/xfinity-usage

Two-factor authentication issue? RuntimeError: Tried 5 times to log in; all failed.

jkc120 opened this issue · 3 comments

Issue

I believe the issue is either two-factor authentication and/or captcha tripping up the script.

Version

xfinity-usage 3.0.1 https://github.com/jantman/xfinity-usage

Installation Method

Ubuntu 16.04.2 LTS, pip2 install xfinity-usage

Supporting Software Versions

  • Python 2.7.12
  • The program 'virtualenv' is currently not installed. You can install it by typing:
    apt install virtualenv
  • selenium==3.141.0

Actual Output

[2020-01-30 17:03:59,902 ERROR] Screenshot saved to: /home/user/t/xfinity-usage/webdriver_fail.png
[2020-01-30 17:03:59,907 ERROR] Page title: Sign in to Xfinity
[2020-01-30 17:03:59,925 ERROR] Page source saved to: /home/user/t/xfinity-usage/webdriver_fail.html
[2020-01-30 17:03:59,925 WARNING] Exception while logging in
Traceback (most recent call last):
File "/home/user/.local/lib/python2.7/site-packages/xfinity_usage/xfinity_usage.py", line 234, in get_usage_page
self.get_usage_page(count=(count + 1))
File "/home/user/.local/lib/python2.7/site-packages/xfinity_usage/xfinity_usage.py", line 230, in get_usage_page
raise RuntimeError("Tried 5 times to log in; all failed.")
RuntimeError: Tried 5 times to log in; all failed.
[2020-01-30 17:04:30,650 ERROR] Error getting usage JSON; falling back to scraping page
snip

Expected Output

Data from the script, right now it can't login due to 2FA on the Xfinity web site sending me a code via SMS.

Testing Assistance

Would be glad to help!

Yup. I've got a moving captcha on my login page now. No more live data use tracking. :-(

webdriver_fail

So long and thanks for all the fish.

Well this is unfortunate! They must be rolling this out to folks, as I don't see the captcha prompt when logging in yet. I guess it's only a matter of time.

If only they would expose the usage data via an API...

It looks like there is indeed an API now which may solve the screen-scarping and captcha issues. A few examples:

... The first approach is an out-of-the-box solution if you're already using home assistant.

The remaining three could probably be adapted to be dockerized and allow for exporting of the necessary data to influxdb.