Я создал с помощью программы API googlemap.
Я не ограничивал API в разработке.
Я развернул программу затем к серверу я включил api restrict.
программа выглядит немного медленной и иногда пропускает ответ.
Мне нужно остановить секунду для программы?
Или настройка плохая?
документ API карты Google
def nearbysearch(apikey, place, centerlatlng, types, radius):
'''
dependency
----------
Places API
parameters
----------
place: tokyo
return
--------
a place\n
place_id, rating\n
e.g. CmRaAAAARRAYThPn0sTB1aE-Afx0_..., 4
'''
url = 'https://maps.googleapis.com/maps/api/place/nearbysearch/json?' \
'location={}&radius={}&type={}&keyword={}&' \
'key={}'
url = url.format(centerlatlng, radius, types, urllib.parse.quote(place), apikey)
# print("nearbysearch:", url)
res = urllib.request.urlopen(url)
////////////// time.sleep(1) ////////////// <- need??
retvalue = None
if res.code == 200:
res_json = json.loads(res.read())
if res_json.get("results"):
retvalue = res_json["results"]
return retvalue
запрос: рамен как японский язык в Сибуя
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=35.6557695,139.7017417&radius=1500&type=restaurant&keyword=%E3%83%A9%E3%83%BC%E3%83%A1%E3%83%B3&key=MY_API_KEY
отсутствует отклик:
{
"error_message" : "API keys with referer restrictions cannot be used with this API.",
"html_attributions" : [],
"results" : [],
"status" : "REQUEST_DENIED"
}
параметр: localhost не работает при ограничении
http://127.0.0.1:8000/*
http://www.henojiya.net/*
веб-сайт:
http://www.henojiya.net/gmarker/
Используется около 200 раз. ![enter image description here](https://i.stack.imgur.com/dgPwK.png)