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
评论列表
文章目录