weather.py 文件源码

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

项目:kino-bot 作者: DongjunLee 项目源码 文件源码
def forecast(self, timely='current'):
        geolocator = GoogleV3()
        location = geolocator.geocode(self.profile.get_location())

        api_key = Config.open_api.dark_sky.TOKEN
        lat = location.latitude
        lon = location.longitude
        dark_sky = forecastio.load_forecast(api_key, lat, lon)

        if timely == 'current':
            currently = dark_sky.currently()
            self.__forecast(currently, timely, location.address)
        elif timely == 'daily':
            hourly = dark_sky.hourly()
            self.__forecast(hourly, timely, location.address)
        elif timely == 'weekly':
            daily = dark_sky.daily()
            self.__forecast(daily, timely, location.address)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号