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:
HaseHarald 2023-07-22 20:28:28 +02:00
parent 0e4dd7d1fb
commit b76f630440
1 changed files with 2 additions and 2 deletions

View File

@ -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):]