From 58e4005073948418c9a890d0105cad368355001b Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 27 Dec 2023 00:38:26 +0100 Subject: [PATCH] Fixed missing satellite images --- update.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/update.py b/update.py index 47ecbc7..998953f 100644 --- a/update.py +++ b/update.py @@ -65,9 +65,11 @@ def main(): ob['norad_cat_id']) sat_name = resp.json()['name'] - sat_img_url = "https://db-satnogs.freetls.fastly.net/media/%s" % ( - resp.json()['image']) - print(sat_img_url) + + sat_img_url = None + if 'image' in resp.json().keys(): + sat_img_url = "https://db-satnogs.freetls.fastly.net/media/%s" % ( + resp.json()['image']) geolocator = Nominatim( user_agent= @@ -100,7 +102,7 @@ def main(): invert_back_white(logo) sat_img = None - if sat_img_url is not None and sat_img_url != '': + if sat_img_url is not None: resp = requests.get(sat_img_url) sat_img_aplha = Image.open(BytesIO(resp.content)).convert('RGBA')