diff --git a/data_sources/weather.py b/data_sources/weather.py index 459c87c..2eefc5c 100644 --- a/data_sources/weather.py +++ b/data_sources/weather.py @@ -646,28 +646,23 @@ def get_metar_reports_from_web( metars = {} metar_list = "%20".join(airport_icao_codes) - request_url = 'http://www.aviationweather.gov/metar/data?ids={}&format=raw&hours=0&taf=off&layout=off&date=0'.format( - metar_list) + request_url = 'https://aviationweather.gov/cgi-bin/data/metar.php?ids={}&hours=0&order=id%2C-obs&sep=true'.format(metar_list) stream = urllib.request.urlopen(request_url, timeout=2) - data_found = False + stream_lines = stream.readlines() stream.close() for line in stream_lines: line_as_string = line.decode("utf-8") - if '' in line_as_string: - data_found = True - elif '' in line_as_string: - break - elif data_found: - identifier, metar = get_metar_from_report_line(line_as_string) - - if identifier is None: - continue - - # If we get a good report, go ahead and shove it into the results. - if metar is not None: - metars[identifier] = metar - __station_last_called__[identifier] = datetime.utcnow() + + identifier, metar = get_metar_from_report_line(line_as_string) + + if identifier is None: + continue + + # If we get a good report, go ahead and shove it into the results. + if metar is not None: + metars[identifier] = metar + __station_last_called__[identifier] = datetime.utcnow() return metars diff --git a/lib/local_debug.py b/lib/local_debug.py index 5f5add6..8ef94d3 100644 --- a/lib/local_debug.py +++ b/lib/local_debug.py @@ -8,7 +8,9 @@ from sys import platform as os_platform import platform -REQUIRED_PYTHON_VERSION = 3.5 +REQUIRED_PYTHON_MAJOR_VERSION = 3 +REQUIRED_PYTHON_REVISION_VERSION = 5 + IS_LINUX = 'linux' in os_platform DETECTED_CPU = platform.machine() IS_PI = "arm" in DETECTED_CPU @@ -22,15 +24,18 @@ def validate_python_version(): Exception -- If the version of Python is not new enough. """ - python_version = float('{}.{}'.format( - version_info.major, version_info.minor)) - error_text = 'Requires Python {}'.format(REQUIRED_PYTHON_VERSION) + error_text = None + + if REQUIRED_PYTHON_MAJOR_VERSION != version_info.major: + error_text = 'Requires Python 3.x, found {}.x'.format(version_info.major) - if python_version < REQUIRED_PYTHON_VERSION: + if REQUIRED_PYTHON_REVISION_VERSION > version_info.minor: + error_text = 'Requires Python 3.5 or newer, found 3.{}'.format(version_info.minor) + + if error_text != None: print(error_text) raise Exception(error_text) - def is_debug(): """ returns True if this should be run as a local debug (Mac or Windows). diff --git a/readme.md b/readme.md index 4af017e..ac3e09a 100644 --- a/readme.md +++ b/readme.md @@ -451,6 +451,7 @@ This mode cycles all of the stations through the spectrum, but all stations shif | Version | Change | | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 2.1.1 | Fix issue where newer versions of Python would not let the code to run. Update to newer NOAA source. Show name of visualizer. | 2.1 | Change precipitation visualizer to pulse the snow color to make it distinct from "nothing" | 2.0.1 | Minor tweak to ceiling categorization. | | 2.0 | Add a remote control app that allows for brightness, night effects, and more to be changed on the fly. Add support for WS2811 and WS2812 based lights. Major performance improvements for adressable RGB LEDs. Selectable visualizers. Removed support for hard wired GPIO based LEDs. | diff --git a/setup.py b/setup.py index 3886ed1..10abc9b 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ setup( name='cateorical-sectional', - version='2.1', + version='2.2.1', python_requires='>=3.7', description='VFR weathermap supporting Adafruit WS2801 lights.', url='https://github.com/JohnMarzulli/categorical-sectional',