我试图通过下面的脚本检索物理地址的经度和纬度.但是我收到了错误.我已经安装了googlemaps.亲切的回复在此先感谢
#!/usr/bin/env python
import urllib,urllib2
"""This Programs Fetch The Address"""
from googlemaps import GoogleMaps
address='Mahatma Gandhi Rd, Shivaji Nagar, Bangalore, KA 560001'
add=GoogleMaps().address_to_latlng(address)
print add
Run Code Online (Sandbox Code Playgroud)
输出:
Traceback (most recent call last):
File "Fetching.py", line 12, in <module>
add=GoogleMaps().address_to_latlng(address)
File "/usr/local/lib/python2.7/dist-packages/googlemaps.py", line 310, in address_to_latlng
return tuple(self.geocode(address)['Placemark'][0]['Point']['coordinates'][1::-1])
File "/usr/local/lib/python2.7/dist-packages/googlemaps.py", line 259, in geocode
url, response = fetch_json(self._GEOCODE_QUERY_URL, params=params)
File "/usr/local/lib/python2.7/dist-packages/googlemaps.py", line 50, in fetch_json
response = urllib2.urlopen(request)
File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 407, …Run Code Online (Sandbox Code Playgroud)