astral.py 文件源码

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

项目:astral 作者: sffjunkie 项目源码 文件源码
def __getitem__(self, key):
        if self.cache and key in self.geocache:
            return self.geocache[key]

        location = Location()
        try:
            self._get_geocoding(key, location)
            self._get_timezone(location)
            self._get_elevation(location)
        except URLError:
            raise AstralError(('GoogleGeocoder: Unable to contact '
                               'Google maps API'))

        url = 'http://maps.google.com/maps?q=loc:%f,%f'
        location.url = url % (location.latitude, location.longitude)

        if self.cache:
            self.geocache[key] = location

        return location
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号