通过地图api计算城市中的所有餐厅

时间:2018-02-28 15:36:55

标签: python google-maps

我正在尝试使用python-google-places api计算我所在城市的所有餐厅

但是没有用,我收到了“失败的响应代码:INVALID_REQUEST”

导致这种情况的原因是什么?

我的代码就是那样

---------------------------------------------------------------------------
GooglePlacesError                         Traceback (most recent call last)
<ipython-input-42-9cc6675b31bc> in <module>()
     21         location='Goiania',
     22         radius=50000,types=[types.TYPE_RESTAURANT],
---> 23         pagetoken=query_result.next_page_token)
     24 
     25 print(counter)

C:\ProgramData\Anaconda3\lib\site-packages\googleplaces\__init__.py in nearby_search(self, language, keyword, location, lat_lng, name, radius, rankby, sensor, type, types, pagetoken)
    303         url, places_response = _fetch_remote_json(
    304                 GooglePlaces.NEARBY_SEARCH_API_URL, self._request_params)
--> 305         _validate_response(url, places_response)
    306         return GooglePlacesSearchResult(self, places_response)
    307 

C:\ProgramData\Anaconda3\lib\site-packages\googleplaces\__init__.py in _validate_response(url, response)
    173         error_detail = ('Request to URL %s failed with response code: %s' %
    174                         (url, response['status']))
--> 175         raise GooglePlacesError(error_detail)
    176 
    177 

GooglePlacesError: Request to URL https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-16.6824083%2C-49.2556573&radius=50000&type=restaurant&pagetoken=CqQCGAEAAAzE3wT0DnczXFlzyjvAaka8vRLZMlsAjF2aqezA8dtGcLIV7ePoqXAUOm0MyxgroXBcKydzt3U3rB2RFvqLijFCbJ3-ucQ-nijN1E7d4aEcC2UlKUR2gNnHfmKYmFVmfQ70lbW-UmCm79WOl2s5oQ8VYoE9bRnr01IphBbVeiS_IDBsCwmsALU4ti5z-7RSYT9ACTCgFs8bVwU9lQ2x_F3v2FtkdqP7UWl5MmNLteox4dSCwa_k3gKD9yd8mCzzos0CvS248uqn_24wLaVubPmxAUrDbSFDhoSx5c8O7S-XrHl4aZ2dx4QUznYXVcEcD_9c-AHKnPoqK-zwh2MVRiHLHNscTnxr4_iCJwsrrOcqlyQrN192HCq9BMADG1tLVxIQ16yZSa5g10FKIcHzFwQqrxoUxS_m8v1Lbr0IbujvfXRi74p71ws&language=en&key=AIzaSyD8YxHJjYdGMO-k7MbOdF807uzEYT-QGYo&sensor=false failed with response code: INVALID_REQUEST

我得到了这个

http

0 个答案:

没有答案