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
|
@ -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…
Reference in New Issue