mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
fix(weather_temp_): Better match temperature and dew point
For whatever reason, sometimes linebreaks are only denoted as \n in the querry-result. This lead to the temperature RegEx matching the dew point. This caused the temperature to be reported the same as the dew point. These changes should make the RegEx more specific and work consistently, no matter if linebreaks are actual linebreaks or just \n.
This commit is contained in:
parent
0e4dd7d1fb
commit
b76f630440
1 changed files with 2 additions and 2 deletions
|
@ -18,8 +18,8 @@ import re
|
|||
|
||||
url = 'https://tgftp.nws.noaa.gov/data/observations/metar/decoded/%s.TXT'
|
||||
|
||||
re_C = re.compile(r'Temperature:.*\((-?\d+\.?\d?) C\)')
|
||||
re_DewC = re.compile(r'Dew.*\((-?\d+\.?\d?) C\)')
|
||||
re_C = re.compile(r'Temperature:\s*[0-9]*\s*[F]*\s*\((-?\d+\.?\d?) C\)')
|
||||
re_DewC = re.compile(r'Dew.*:\s*[0-9]*\s*[F]*\s*\((-?\d+\.?\d?) C\)')
|
||||
|
||||
code = sys.argv[0][(sys.argv[0].rfind('_') + 1):]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue