From c3284ef070baf52320b1a3609f84b6374735b2b0 Mon Sep 17 00:00:00 2001 From: sq9atk Date: Sat, 18 Nov 2023 20:09:54 +0100 Subject: [PATCH] =?UTF-8?q?Poprawka=20wy=C5=9Bwietlania=20komunikat=C3=B3w?= =?UTF-8?q?=20w=20konsoli?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- propagation_sq9atk.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/propagation_sq9atk.py b/propagation_sq9atk.py index 43b4e3e..3a6573e 100755 --- a/propagation_sq9atk.py +++ b/propagation_sq9atk.py @@ -44,9 +44,9 @@ class PropagationSq9atk(SR0WXModule): webFile.retrieve(url, "propagacja.png") return Image.open("propagacja.png",'r') except socket.timeout: - print "Timed out!" + print "Timed out!\n" except: - print "Data download error!" + print "Data download error!\n" return def collectBandConditionsFromImage(self, image, dayTime): @@ -84,24 +84,24 @@ class PropagationSq9atk(SR0WXModule): def get_data(self): image = self.downloadImage(self.__service_url) - self.__logger.info("::: Przetwarzam dane...\n") + message = ''; + if image: + self.__logger.info("::: Przetwarzam dane...\n") - day = self.collectBandConditionsFromImage(image, 'day') - night = self.collectBandConditionsFromImage(image, 'night') + day = self.collectBandConditionsFromImage(image, 'day') + night = self.collectBandConditionsFromImage(image, 'night') - if len(day) and len(night): - message = " ".join([ - " _ informacje_o_propagacji ", - " _ dzien _ ", - " _ pasma _ ", - " _ " .join( day ), - " _ noc _ ", - " _ pasma _ ", - " _ " .join( night ), - " _ " - ]) - else: - message = '' + if len(day) and len(night): + message = " ".join([ + " _ informacje_o_propagacji ", + " _ dzien _ ", + " _ pasma _ ", + " _ " .join( day ), + " _ noc _ ", + " _ pasma _ ", + " _ " .join( night ), + " _ " + ]) return { "message": message,