# HG changeset patch # User Daniel O'Connor # Date 1605590276 -37800 # Node ID 5dbc310f1eca2b34379cc2adf9e6829ffc76660b # Parent 815e6b61d76e545a1d265c6e0a7eb896e8e2cec0 Fix uptime parser broken by previous commit. Add comment about it while I'm here. diff -r 815e6b61d76e -r 5dbc310f1eca adslstats.py --- a/adslstats.py Sat Nov 14 15:05:07 2020 +1030 +++ b/adslstats.py Tue Nov 17 15:47:56 2020 +1030 @@ -200,7 +200,8 @@ uptime = re.findall('([0-9]+)', list(bs.findAll('label', text = 'DSL Uptime')[0].fetchNextSiblings()[0].strings)[0]) uptime.reverse() # End up with an array of seconds, minutes, hours, etc mults = [1, 60, 60 * 60, 24 * 60 * 60] - if len(uptime) != len(mults): + # Basic sanity check of the number of elements, should be at least 1 + if len(uptime) == 0 or len(uptime) > len(mults): print('Unexpected number of uptime elements (%s)' % str(uptime)) stats.uptime = None else: