I'm trying to use a list of variables to run to get data from an IBM BigFix Relay Diagnostic Page, currently using defined variables I can run the following to get what I need:
def fs_grab(urllookup):
try:
html = requests.get(urllookup, timeout=3).text
fs_start = 'FillDB File Size Limit:</div><div class="forminput">'
fs_end = '% ( '
fs = html.split(fs_start)[-1].split(fs_end)[0]
fs = float(fs)
return fs
except Exception:
logging.error('Timeout', exc_info=True)
pass
How can I get the fs value from a list of variables and append to the list? Eventually I would like to insert them into a MySQL Database, but for now, just trying one step at a time and append it to the existing list if possible.
Raw markup:
<div class="formline"><div class="formlabel">FillDB File Size Limit:</div><div class="formlabel">FillDB File Size Limit:</div><div class="forminput">0.0% ( 0 / 826634880 Bytes )</div></div><div class="formline"><div class="formlabel">FillDB File Count Limit:</div><div class="forminput">0.06% ( 6 / 10000 Files )</div></div><div class="formline"><div class="formlabel">FillDB BigFix Query File Size Limit:</div><div class="forminput">0.0% ( 0 / 3145728 Bytes )</div>
Pretty printed
<div class="formline">
<div class="formlabel">FillDB File Size Limit:</div>
<div class="formlabel">FillDB File Size Limit:</div>
<div class="forminput">0.0% ( 0 / 826634880 Bytes )</div>
</div>
<div class="formline">
<div class="formlabel">FillDB File Count Limit:</div>
<div class="forminput">0.06% ( 6 / 10000 Files )</div>
</div>
<div class="formline">
<div class="formlabel">FillDB BigFix Query File Size Limit:</div>
<div class="forminput">0.0% ( 0 / 3145728 Bytes )</div>
</div>
The HTML of the page is above, I'm really only looking for the numerical values of the File Size and File Count