API & Client - remove DarkSky weather provider

This commit is contained in:
Sam
2023-04-11 16:55:18 +02:00
parent ef65689263
commit 642b15d521
6 changed files with 6 additions and 193 deletions

View File

@@ -5,14 +5,12 @@ from gpxpy.gpx import GPXTrackPoint
from fittrackee import appLog
from .dark_sky import DarkSky
from .visual_crossing import VisualCrossing
class WeatherService:
"""
Available API:
- DarkSky (deprecated, will end on March 31st, 2023)
- VisualCrossing
"""
@@ -20,7 +18,7 @@ class WeatherService:
self.weather_api = self._get_weather_api()
@staticmethod
def _get_weather_api() -> Union[DarkSky, VisualCrossing, None]:
def _get_weather_api() -> Union[VisualCrossing, None]:
weather_api_key: str = os.getenv('WEATHER_API_KEY', '')
weather_api_provider: str = os.getenv(
'WEATHER_API_PROVIDER', ''
@@ -28,8 +26,6 @@ class WeatherService:
if not weather_api_key:
return None
if weather_api_provider == 'darksky': # deprecated
return DarkSky(weather_api_key)
if weather_api_provider == 'visualcrossing':
return VisualCrossing(weather_api_key)
return None