def __init__(self, *commands, token=None, prefixes=None, strict=False):
"""Answers with a weather in user's city or on specified addres."""
if not token:
raise ValueError("Token is not specified! Get it from: https://darksky.net")
super().__init__(*commands, prefixes=prefixes, strict=strict)
self.token = token
self.icons = {
"clear-day": "??",
"clear-night": "??",
"cloudy": "??",
"fog": "??",
"partly-cloudy-day": "??",
"partly-cloudy-night": "??",
"rain": "??",
"sleet": "?? ??",
"snow": "??",
"wind": "??",
"error": "??",
}
self.geocoders = []
for coder in [Photon, Yandex, Nominatim]:
self.geocoders.append(coder())
self.coords_cache = {}
self.weather_cache = {}
self.weather_clear = time.time() + 12 * 60 * 60
self.api_lim = 95
self.api_lim_clear = time.time() + 24 * 60 * 60
self.api_lim_count = 0
评论列表
文章目录