jantman / xfinity-usage

Python/selenium script to get Xfinity bandwidth usage
GNU Affero General Public License v3.0
66 stars 18 forks source link

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

Open jkc120 opened 4 years ago

jkc120 commented 4 years ago

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

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!

Artem-B commented 4 years ago

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.

billimek commented 4 years ago

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...

billimek commented 4 years ago

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.