billimek / comcastUsage-for-influxdb

This tool allows you to run periodic comcast data usage checks and save the results to InfluxDB for graphing in Grafana
7 stars 7 forks source link

Keeps failing #1

Open aberrix opened 6 years ago

aberrix commented 6 years ago

this has been failing for me lately, I am running it in a docker on unRAID.

here is the log:

`Loading Configuration File config.ini Configuration Successfully Loaded /usr/local/lib/python3.6/site-packages/selenium/webdriver/phantomjs/webdriver.py:49: UserWarning: Selenium support for PhantomJS has been deprecated, please use headless versions of Chrome or Firefox instead warnings.warn('Selenium support for PhantomJS has been deprecated, please use headless ' Traceback (most recent call last): File "/src/InfluxdbComcast.py", line 144, in main() File "/src/InfluxdbComcast.py", line 140, in main collector.run() File "/src/InfluxdbComcast.py", line 98, in run self.total = int(res['total']) TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType' Loading Configuration File config.ini Configuration Successfully Loaded /usr/local/lib/python3.6/site-packages/selenium/webdriver/phantomjs/webdriver.py:49: UserWarning: Selenium support for PhantomJS has been deprecated, please use headless versions of Chrome or Firefox instead warnings.warn('Selenium support for PhantomJS has been deprecated, please use headless ' [2018-05-02 08:20:57,605 ERROR] Screenshot saved to: /src/webdriver_fail.png

[2018-05-02 08:20:57,608 ERROR] Page title: Sign in to Xfinity

[2018-05-02 08:20:57,615 ERROR] Page source saved to: /src/webdriver_fail.html

[2018-05-02 08:20:57,615 WARNING] Exception while logging in

Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/xfinity_usage/xfinity_usage.py", line 233, in get_usage_page self.do_login() File "/usr/local/lib/python3.6/site-packages/xfinity_usage/xfinity_usage.py", line 207, in do_login raise RuntimeError("Login button clicked but no redirect") RuntimeError: Login button clicked but no redirect [2018-05-02 08:21:02,871 ERROR] Error getting usage JSON; falling back to scraping page

Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/xfinity_usage/xfinity_usage.py", line 131, in run res.update(self.extract_current_from_json(deepcopy(res['raw']))) File "/usr/local/lib/python3.6/site-packages/xfinity_usage/xfinity_usage.py", line 267, in extract_current_from_json for item in raw['usageMonths']: KeyError: 'usageMonths'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/src/InfluxdbComcast.py", line 144, in main() File "/src/InfluxdbComcast.py", line 140, in main collector.run() File "/src/InfluxdbComcast.py", line 93, in run res = xfinity.run() File "/usr/local/lib/python3.6/site-packages/xfinity_usage/xfinity_usage.py", line 138, in run res = self.get_usage() File "/usr/local/lib/python3.6/site-packages/xfinity_usage/xfinity_usage.py", line 323, in get_usage raise RuntimeError('Cannot parse string: %s' % meter.text) RuntimeError: Cannot parse string: 73GB used this month Loading Configuration File config.ini Configuration Successfully Loaded /usr/local/lib/python3.6/site-packages/selenium/webdriver/phantomjs/webdriver.py:49: UserWarning: Selenium support for PhantomJS has been deprecated, please use headless versions of Chrome or Firefox instead warnings.warn('Selenium support for PhantomJS has been deprecated, please use headless ' Traceback (most recent call last): File "/src/InfluxdbComcast.py", line 144, in main() File "/src/InfluxdbComcast.py", line 140, in main collector.run() File "/src/InfluxdbComcast.py", line 98, in run self.total = int(res['total']) TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'`

billimek commented 6 years ago

@aberrix not sure why this would be happening for you. I'm not seeing any of these errors right now.

One thing to try: Can you try logging in manually using a web browser to see if it is redirecting you to a special page (maybe to update your security questions or some other non-normal workflow)?

I had a problem a while back where it was throwing similar exceptions (see this) and it turned out I just needed to log in via the browser once to get it sorted.

aberrix commented 6 years ago

I recently upgraded to unlimited, I'm guessing it might be failing because it is looking for a 1Tb Policy?

billimek commented 6 years ago

I think that must be it. There is a line of code that assumes there is a total amount. Let me see how I can make this not fail for situations where there is no 'total'.

tbabula commented 4 years ago

@billimek

It fails for me on using pull image from dockerhub and it seems it is related to Comcast changing website authentication mechanism that now rejects headless browser session from python script https://github.com/jantman/xfinity-usage/issues/30

rocket4321 commented 3 years ago

In order to make this project work, I believe it needs all dependencies included. I have fully working solution, so I hope it benefits others like me who are victims of Xfinity/Comcast. Please feel free to open an issue even if it's working!

https://github.com/rocket4321/xfinity-usage-docker