HTTP Error 403 with api_id in accessing Google Maps

前端 未结 3 871
感情败类
感情败类 2020-12-18 15:13

I am planning to use the package \"googlemaps\" in Python and had trouble with the api_id.

The following codes:

from googlemaps import GoogleMaps
gma         


        
3条回答
  •  醉梦人生
    2020-12-18 15:55

    Api v2 was closed down on sept 13, 2013. Your question was asked on 14th - so that migh be a clue :) . What I managed to do is simply modify URLs in googlemaps.py and now it's working OK for routing.

    I changed _DIRECTIONS_QUERY_URL (line 165 of googlemaps.py) to:

    _DIRECTIONS_QUERY_URL = 'http://maps.googleapis.com/maps/api/directions/output?'
    

    And it worked fine. Also I tried modiying line 164: _GEOCODE_QUERY_URL = 'http://maps.googleapis.com/maps/api/geocode/output?' as suggested here but there's some error, and a) I don't need it anyway b) it's already covered by pygeocoder which is a bit more advanced that googlemaps.py

提交回复
热议问题