I am trying (first python attempt) to pull information from a web page and store is for further use. Here is the code that opens the page and gets the information.
# -*- coding: utf-8 -*-
#python
from urllib import urlopen
myfile = urlopen('http://192.168.0.1/stlui/user/allowance_request.html%20target=%22allowance%22').read()
print myfile
The following is the output from print myfile.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta http-equiv="refresh" Content="60;url=/stlui/user/allowance_request.html">
<title>Download Allowance Status</title></head><body><h3 style="font-size: 150%; color:blue; text-align:center; font-weight:bold">DOWNLOAD ALLOWANCE STATUS</h3><TABLE width='100%' cellpadding='10'><tr><td style="text-align:center;"><h3>Usage within allowance - no download restrictions</h3></td><td><span style="display:block;text-align:center">100%</span><table style="font-size:1; background-color:white; border:1px solid black;" width='15%' cellspacing='0' cellpadding='0' align='center'><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr><tr style="background-color:green"><td> </td></tr></table><span style="display:block;text-align:center">0%</span></td></tr><tr><td> </td><td><table style="font-size:18; border-width:0px;" width=90% cellspacing=0 cellpadding=0 ALIGN=CENTER><tr><td> </td><td style="border-width:0px;">Plan Allowance (MB)</td><td style="border-width:0px;"> 625</td></tr><tr><td> </td><td style="border-width:0px;">Allowance Remaining (MB)</td><td style="border-width:0px;"> 625</td></tr><tr><td><span style="background-color: green;"> </span> </td><td style="border-width:0px;">Allowance Remaining (%)</td><td style="border-width:0px;"> 100</td></tr><tr><td> </td><td style="border-width:0px;">Time Until Allowance Refill</td><td style="border-width:0px;"> 22:18:01</td></tr></table></td></tr></TABLE>
</body>
</html>
The information I want is at the bottom, "Plan Allowance (MB) 625 , Allowance Remaining (MB) 625, Allowance Reamining (%) 100 and Time Until Allowance Refill 22:18:01. The actual numbers for the four items will change. I need the to run every 60 seconds. Thanks for any and all help. ie code, example python script etc..
Frank