diff --git a/yin_yang/config.py b/yin_yang/config.py index cc2dfde..be1b0c2 100755 --- a/yin_yang/config.py +++ b/yin_yang/config.py @@ -326,7 +326,7 @@ def defaults(self) -> dict: 'running': False, 'dark_mode': False, 'mode': Modes.MANUAL.value, - 'coordinates': (0, 0), + 'coordinates': (0.0, 0.0), 'update_location': False, 'update_interval': 60, 'times': ('07:00', '20:00'), diff --git a/yin_yang/position.py b/yin_yang/position.py index 33f2583..79fc891 100644 --- a/yin_yang/position.py +++ b/yin_yang/position.py @@ -51,9 +51,14 @@ def get_qt_position() -> QGeoCoordinate: def get_ipinfo_position() -> QGeoCoordinate: # use the old method as a fallback - response = requests.get('https://www.ipinfo.io/loc') + try: + response = requests.get('https://www.ipinfo.io/loc') + except Exception as e: + logger.error(e) + raise TypeError('Error while sending a request to get location') + if not response.ok: - logger.error('Failed to get location from ipinfo.io') + raise TypeError('Failed to get location from ipinfo.io') loc_response = response.text.removesuffix('\n').split(',') loc: [float] = [float(coordinate) for coordinate in loc_response]