weather.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:sketal 作者: vk-brain 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号