-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for the TC4400 modem #15
Comments
Thanks for opening the issue. Do you have access to a TC4400? Unfortunately I don't, but I'm happy to take a contribution to the project if you do. |
I do yeah, I may work on it eventually! Any suggestions on where to start/things to watch out for? |
That depends a bit in particular how you need to authenticate to the modem. If it's a simple process you could follow the process from the MB8600 modem. If you need to run complex javascript and if it is too complicated to replicate through a few POST calls, then you can follow the TG3492 approach, where Selenium is leveraged to navigate the actual login page through a virtual browser session. |
The way auth works is you just pass simple HTTP Authentication parameters with every request |
I've refactored the code a bit. You should be able to create a copy of the Technicolor_xb7 modem or similar and focus on implementing the collectStatus() method, then register your modem in modemtype.py with a new string. Said string can then be used in a configuration. If possible, add a few unittests for the new modem with sample content and responses (successful, failed logins, sample channels page, etc.). I may add more tests to the existing modems soon, so you could use that as a template to follow. |
Dumping this out here as I used this to get a scraper for the TC4400 going. I'm not entirely sure where the rest of the script went that did the output/formatting, especially considering the CODA45 scraper I wrote after that is in its (mostly) complete state (had a full import requests
from bs4 import BeautifulSoup as bs
from pandas import read_html as rh
auth = requests.auth.HTTPBasicAuth('admin', 'bEn2o#US9s')
if __name__ == '__main__':
# Pull modem page data
d = requests.get("http://192.168.100.1/cmconnectionstatus.html", auth=auth)
# Pull modem event logs
l = requests.get("http://192.168.100.1/cmeventlog.html", auth=auth)
# Parse out the page data
dp = bs(d.text, 'lxml')
lp = bs(l.text, 'lxml')
# Pull out the tables of interest
ds, us, md = dp.find_all('table')[1:4]
ip = rh(str(md))[0][0][1].split('=')[1]
uptime = rh(str(md))[0][1][1]
ds = rh(str(ds), skiprows=1)[0]
us = rh(str(us), skiprows=1)[0] |
No description provided.
The text was updated successfully, but these errors were encountered: