Cox Communications - Internet Usage

I scrapped what I had before, and started straight at the okta api. I am pleased to say I am able to request a token, then use that to auth to cox. I will probably have it back up and running real soon!!!

2 Likes

Great news. Looking forward to your solution :grinning:

New release! I also fixed the reboot modem switch while i was at it.

That’s awesome. Where can I find it?

Works great! Thanks so much !!

Look here:

Since March 9, I’ve been getting this error when running the docker image to get Cox usage stats. Anyone else seeing this? Any ideas?

File "/usr/bin/coxusage.py", line 27, in <module>
    username = driver.find_element_by_id("okta-signin-username")
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 360, in find_element_by_id
    return self.find_element(by=By.ID, value=id_)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 976, in find_element
    return self.execute(Command.FIND_ELEMENT, {
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="okta-signin-username"]"}
  (Session info: headless chrome=77.0.3865.120)

Login to your cox account and see if the data usage is updated. Mine is at 0 for the month and has been for a few days. Believe cox is having issues with their app.

My usage is being updated correctly on the Cox site. Here’s a screenshot:

Hello from Aussie who is using Optus and looking for something similar. Did you end up finding a solution?

Loving this integration. Is there anyway to treat this as an utility device to pull the data into the new Energy Dashboard?

Hi all, sorry to revive an old thread, yet it looks like this is the right place. I’ve been wanting to get a scraper running against the Cox Internet usage page for a while. A couple of questions:

  1. As of Sept 2022 is anyone able to verify that any scraping works? Cox making it harder to scrape, so I wanted to clarify if anyonehas anything actually working as of today?

  2. I would have liked to run the docker image made available, however according to the tags, it’s only built for linux/amd64. Provided the python script inside still works, is there any chance of a linux/arm64 rebuild for the Raspberry pi?

  3. If an updated docker container is not on the table, can the depreciated cox_usage.py script be modified to work at all? I tried pulling it from the old repo just to see what it would do, but it seems to run afoul of the site, already when trying to authenticate:

Traceback (most recent call last):
  File "/home/pi/coxusage/cox_usage.py", line 43, in <module>
    login_form = mechanicalsoup.Form(
  File "/home/pi/.local/lib/python3.9/site-packages/mechanicalsoup/form.py", line 38, in __init__
    if form.name != 'form':
AttributeError: 'NoneType' object has no attribute 'name'

Would love to hear some feedback from the community as to what’s possible in terms of scraping the Cox internet usage page as of today.

They are using okta, along with MFA(from what I can tell) so it is might be pretty difficult. Your best bet is finding someone that has a working okta login wrapper without the need for an API key.