Dan*_*Dan 2 python google-app-engine google-maps
我正在使用Google Maps API通过适用于Google Maps Web Services的Python客户端库在Google App Engine中设置项目
我尝试了以下示例代码:
import googlemaps
gmaps = googlemaps.Client(key='MY API KEY HERE')
geocode_result = gmaps.geocode('1600 Amphitheatre Parkway, Mountain View, CA')
Run Code Online (Sandbox Code Playgroud)
是的,我确实把我的实际API密钥放在那里.事实上,它在Anaconda iPython控制台中运行良好,但在Google Apps Engine中,我得到:
文件"C:\ Users\Dan\Documents\Apps\oncourse\main.py",第31行
geocode_result = gmaps.geocode('1600 Amphitheatre Parkway,Mountain View,CA')
文件"C:\ Users\Dan\Documents\Apps\oncourse\lib\googlemaps\geocoding.py",第68行,地理编码
return client._get("/ maps/api/geocode/json",params)["results"]
文件"C:\ Users\Dan\Documents\Apps\oncourse\lib\googlemaps\client.py",第204行,在_get中
提高googlemaps.exceptions.TransportError(e)
TransportError :('连接已中止.',错误(13,'权限被拒绝'))
INFO 2015-11-22 20:14:23,002 module.py:794]默认值:"GET/HTTP/1.1"500 -
这个错误究竟意味着什么?
我想我没有正确设置所有库,
我的app.yaml文件包含
libraries:
- name: ssl
version: latest
Run Code Online (Sandbox Code Playgroud)
我在我的应用程序的根目录中的lib文件夹中安装了googlemaps库.该gmaps=Client(key)实例化的工作(我通过输出gmaps.key测试过),所以我相信我有谷歌地图图书馆正确设置.
小智 6
我遇到过同样的问题.似乎问题是安装的请求版本.我已经安装了谷歌内部映射库使用
pip install -t lib googlemaps
Run Code Online (Sandbox Code Playgroud)
这已经在libs中安装了request-2.6.我删除了要求和请求,2.6.0.dist-信息从手动目录库,然后安装请求-2.3使用
pip install -t lib requests==2.3
Run Code Online (Sandbox Code Playgroud)
这解决了我的问题.希望能帮助到你.
| 归档时间: |
|
| 查看次数: |
705 次 |
| 最近记录: |