From 1c6fd2c60cb8885f4d927a7a8732ab5e1fa73d36 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Sat, 20 Jul 2024 09:26:58 -0700 Subject: [PATCH] Update locationdata.py --- modules/locationdata.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/locationdata.py b/modules/locationdata.py index 7a5aa5c..b7ec979 100644 --- a/modules/locationdata.py +++ b/modules/locationdata.py @@ -44,12 +44,14 @@ def get_tide(lat=0, lon=0): station_json = station_data.json() else: return ERROR_FETCHING_DATA + + if station_id is None: + return "no station found" + station_id = station_json['stationList'][0]['stationId'] + except (requests.exceptions.RequestException, json.JSONDecodeError): return ERROR_FETCHING_DATA - - if station_id is None: - return "no station found" station_url = "https://tidesandcurrents.noaa.gov/noaatidepredictions.html?id=" + station_id