From 26099676df55382733b0be0836c4b8cd8cbcae67 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Tue, 25 Jun 2024 12:02:15 -0700 Subject: [PATCH] Update locationdata.py --- locationdata.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/locationdata.py b/locationdata.py index ed9df2e..32340e8 100644 --- a/locationdata.py +++ b/locationdata.py @@ -7,6 +7,7 @@ import requests # pip install requests import bs4 as bs # pip install beautifulsoup4 URL_TIMEOUT = 10 # wait time for URL requests +DAYS_OF_WEATHER = 4 # weather forecast days, the first two rows are today and tonight def where_am_i(lat=0, lon=0): whereIam = "" @@ -93,6 +94,7 @@ def get_weather(lat=0, lon=0): .replace("Today", "Today ") \ .replace("Tonight", "Tonight ") \ .replace("Tomorrow", "Tomorrow ") \ + .replace("This Afternoon", "Afternoon ") \ .replace("northwest", "NW") \ .replace("northeast", "NE") \ .replace("southwest", "SW") \ @@ -113,7 +115,7 @@ def get_weather(lat=0, lon=0): .replace("showers", "shwrs") \ .replace("thunderstorms", "t-storms") #only grab a few days of weather - if len(weather.split("\n")) < 4: + if len(weather.split("\n")) < DAYS_OF_WEATHER: weather += line + "\n" #trim off last newline weather = weather[:-1]