tmobile-monitor/main.py

35 lines
1008 B
Python

import requests
from bs4 import BeautifulSoup
url = 'http://192.168.1.1'
response = requests.get(url, verify=False)
soup = BeautifulSoup(response.text, 'html.parser')
snr_element = soup.find('div', id='snr')
pci_element = soup.find('div', id='pci')
rsrp_element = soup.find('div', id='internetStatusRSRP')
rsrq_element = soup.find('div', id='internetStatusRSRQ')
if snr_element:
snr_value = snr_element.text.strip().split()[0] # Extracting the numerical part
print(f"SNR value: {snr_value}")
else:
print("SNR value not found on the page.")
if pci_element:
pci_value = pci_element.text.strip()
print(f"PCI value: {pci_value}")
else:
print("PCI value not found on the page.")
if rsrp_element:
rsrp_value = rsrp_element.text.strip()
print(f"RSRP value: {rsrp_value}")
else:
print("RSRP value not found on the page.")
if rsrq_element:
rsrq_value = rsrq_element.text.strip()
print(f"RSRQ value: {rsrq_value}")
else:
print("RSRQ value not found on the page.")