Can pass GPS as GPS env

This commit is contained in:
nemunaire 2022-08-11 16:35:30 +02:00
parent e42a4bc1d6
commit 9c3a3ff3c4

View File

@ -6,10 +6,10 @@ import urllib.request
class DarkSkyAPI:
def __init__(self, apikey=None, gps="48.8127,2.3437", opts={"lang": "fr", "units": "ca"}):
def __init__(self, apikey=None, gps=None, opts={"lang": "fr", "units": "ca"}):
self.apikey = apikey or os.environ["DARKSKYAPIKEY"]
self.baseurl = "https://api.darksky.net/forecast"
self.default_gps = gps
self.default_gps = gps or ("GPS" in os.environ and os.environ["GPS"]) or "48.8127,2.3437"
self.opts = opts
self._cached_file = ".darksky-%s.cache"